C
C   ROTORCRAFT DYNAMICS
C   WAYNE JOHNSON          NASA-ARC/USAAMRDL
C   FEBRUARY 1976
C
      COMMON /HLCOEF/A2(6400),A1(6400),A0(6400),B0(2320),MX,MX1,MV,MVG,D-
     1OF1(80)
      INTEGER DOF1
      COMMON  /RCOEF/A2R1(30,30),A1R1(30,30),A0R1(30,30),AA2R1(30,6),AA1-
     1R1(30,6),AA0R1(30,6),BR1(30,8),BGR1(30,3),C2R1(6,30),C1R1(6,30),C0-
     2R1(6,30),CA2R1(6,6),CA1R1(6,6),CA0R1(6,6),DGR1(6,3)
      COMMON /R2COEF/A2R2(30,30),A1R2(30,30),A0R2(30,30),AA2R2(30,6),AA1-
     1R2(30,6),AA0R2(30,6),BR2(30,8),BGR2(30,3),C2R2(6,30),C1R2(6,30),C0-
     2R2(6,30),CA2R2(6,6),CA1R2(6,6),CA0R2(6,6),DGR2(6,3)
      COMMON /BCOEF/CAW(12,16),CB1W(3,3),CB2W(3,3),A2W(16,19),A1W(16,19)-
     1,A0W(16,19),BW(16,4),BGW(16,3),AAW(16,12)
      COMMON /HINPUT/TITLE(18),VTIP,RPM,VEL,VKTS,OPUNIT,ALTMSL,TEMP,ALTA-
     1GL,ACLIMB,AYAW,APITCH,AROLL,COLL,LNGCYC,LATCYC,PEDAL,WEIGHT,AFLAP,-
     2ITER,EPTRIM,FACTOR,PTRIM,DOF(80),CON(26),GUST(3),OPSYMM,DOFSYM(80)-
     3,CONSYM(26),GUSSYM(3),OPFLOW,OPTORS(2),OPMOTR,OPLMDA(2),OPINTR,OPQ-
     4RTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,TONLY,MPER,JCNST,NSYS-
     5AN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP(80),CONP(29),CNTRL0,CNT-
     6RLC,CNTRLS,CNTRLP,THETFP,PSIFP,THETAF,PHIF,VELX,VELY,VELZ,GRAV,DEN-
     7SE,CSOUND,FREQ(100)
      COMMON /GINPUT/ORIENT,ASHAFT(2),ACANT(2),K12H,K12F,K12L,K21H,K21F,-
     1K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR-
     22,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,TAUH,TAUV,RTRANS,IENG,KMAST1,KM-
     3AST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,TH-
     4RTLC,NRPOWR,EDAMPC,KPMC1(10),KPMS1(10),KPMC2(10),KPMS2(10),FSR1,WL-
     5R1,BLR1,FSR2,WLR2,BLR2,FSCG,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX-
     6,IYY,IZZ,IXZ,XRTR1,YRTR1,ZRTR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,X-
     7VT,ZVT,AMASS,AIXX,AIYY,AIZZ,AIXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCF-
     8E,PRCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCC-
     9FE,PSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ(11),TCFE-
     A(11,5),QMASS(10),QFREQ(10),QDAMP(10),ZETAR1(3,10),ZETAR2(3,10),GAM-
     BAR1(3,10),GAMAR2(3,10),NEM,RSF1(3,3),RSF2(3,3),RFV(3,3),RSV1(3,3),-
     CRSV2(3,3),ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,EDAMP,QTHRTL
      INTEGER OPUNIT,ORIENT,DOF,CON,GUST,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPF-
     1LOW,OPTORS,OPMOTR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND-
     2,OPAERO,DEBUG,TONLY,RESPON,DOFP,CONP,ENGPOS
      REAL LNGCYC,LATCYC,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWR-
     1TR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,IENG,KMAST1,KMAST2,KICS,KENG,KPR1G-
     2V,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,NRPOWR,KPMC1,KPMC2,KPMS1,KPMS-
     32,IXX,IYY,IZZ,IXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,KF0CFE,KR0CFE,KFSCFE-
     4,KRSCFE,KCCFE,KSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,LMDA-
     501,LMDA02
      COMMON /R1DATA/HHR1(667)
      EQUIVALENCE (RADUS1,HHR1(14)),(VTIPN1,HHR1(79)),(IB1,HHR1(32)),(NB-
     1LAD1,HHR1(2)),(NBM1,HHR1(9)),(NTM1,HHR1(10)),(OMEGA1,HHR1(13)),(GI-
     2MBL1,HHR1(11)),(KPB1(1),HHR1(50)),(KPG1,HHR1(35)),(TRC1,HHR1(21)),-
     3(TRS1,HHR1(22)),(MU1,HHR1(6)),(MUY1,HHR1(88)),(MUZ1,HHR1(89)),(LAM-
     4DA1,HHR1(7)),(KHLMD1,HHR1(655)),(KFLMD1,HHR1(656)),(GAMMA1,HHR1(12-
     5)),(SIGMA1,HHR1(15)),(OPAER1,HHR1(16)),(OPMOD1,HHR1(26)),(ROTAT1,H-
     6HR1(663))
      INTEGER GIMBL1,OPAER1,OPMOD1,ROTAT1
      REAL MU1,MUY1,MUZ1,LAMDA1,KHLMD1,KFLMD1,KPB1(5),KPG1,IB1
      COMMON /R2DATA/HHR2(667)
      EQUIVALENCE (RADUS2,HHR2(14)),(VTIPN2,HHR2(79)),(IB2,HHR2(32)),(NB-
     1LAD2,HHR2(2)),(NBM2,HHR2(9)),(NTM2,HHR2(10)),(OMEGA2,HHR2(13)),(GI-
     2MBL2,HHR2(11)),(KPB2(1),HHR2(50)),(KPG2,HHR2(35)),(TRC2,HHR2(21)),-
     3(TRS2,HHR2(22)),(MU2,HHR2(6)),(MUY2,HHR2(88)),(MUZ2,HHR2(89)),(LAM-
     4DA2,HHR2(7)),(KHLMD2,HHR2(655)),(KFLMD2,HHR2(656)),(GAMMA2,HHR2(12-
     5)),(SIGMA2,HHR2(15)),(OPAER2,HHR2(16)),(OPMOD2,HHR2(26)),(ROTAT2,H-
     6HR2(663))
      INTEGER GIMBL2,OPAER2,OPMOD2,ROTAT2
      REAL MU2,MUY2,MUZ2,LAMDA2,KHLMD2,KFLMD2,KPB2(5),KPG2,IB2
      NAMELIST /NLCYC/NCYCLE
      NAMELIST /NLHL/VTIP,RPM,VEL,VKTS,VELX,VELY,VELZ,WEIGHT,ASHAFT,ACAN-
     1T,ORIENT,ACLIMB,AYAW,APITCH,AROLL,THETFP,PSIFP,THETAF,PHIF,ALTMSL,-
     2TEMP,ALTAGL,DENSE,CSOUND,ALTD,GRAV,COLL,LNGCYC,LATCYC,PEDAL,AFLAP,-
     3DOF,CON,GUST,OPUNIT,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPFLOW,OPTORS,OPMO-
     4TR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,T-
     5ONLY,MPER,JCNST,NSYSAN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP,CON-
     6P,ITER,EPTRIM,FACTOR,PTRIM,FREQ,FSR1,WLR1,BLR1,FSR2,WLR2,BLR2,FSCG-
     7,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX,IYY,IZZ,IXZ,XRTR1,YRTR1,ZR-
     8TR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,XVT,ZVT,AMASS,AIXX,AIYY,AIZZ-
     9,AIXZ,RSF1,RSF2,RFV,RSV1,RSV2,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCFE,P-
     ARCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCCFE,-
     BPSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ,TCFE,CNTRL0-
     C,CNTRLC,CNTRLS,CNTRLP,QMASS,QFREQ,QDAMP,ZETAR1,ZETAR2,GAMAR1,GAMAR-
     D2,NEM,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KH-
     ERTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR2,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,-
     FTAUH,TAUV,RTRANS,IENG,KMAST1,KMAST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV-
     G,KPR2GV,KIR2GV,KPEGOV,KIEGOV,THRTLC,NRPOWR,EDAMPC,KPMC1,KPMS1,KPMC-
     H2,KPMS2,EDAMP,QTHRTL,ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,DLDZ1-
     I,DLDZ2,CNSTL1,CNSTL2,VTIP2,RPM2,TITLE
      NAMELIST /NLEQ/A2,A1,A0,B0,MX,MX1,MV,MVG,MX0,DOF0,DOF1
      NAMELIST /NLR/A2R1,A1R1,A0R1,AA2R1,AA1R1,AA0R1,BR1,BGR1,C2R1,C1R1,-
     1C0R1,CA2R1,CA1R1,CA0R1,DGR1,A2R2,A1R2,A0R2,AA2R2,AA1R2,AA0R2,BR2,B-
     2GR2,C2R2,C1R2,C0R2,CA2R2,CA1R2,CA0R2,DGR2
      NAMELIST /NLS/CAW,CB1W,CB2W,A2W,A1W,A0W,BW,BGW,AAW
      REAL B(2080),BG(240),PHI(1800)
      EQUIVALENCE (B0(1),B(1)),(B0(2081),BG(1))
      INTEGER DOF0(80)
      REAL CKNOT(2),C2H(16,12),C1H(16,12),C0H(16,12),BGH1(30,3),BGH2(30,-
     13),DGH1(6,3),DGH2(6,3)
      EQUIVALENCE (B0(1),BGH1(1,1)),(B0(91),BGH2(1,1)),(B0(181),DGH1(1,1-
     1)),(B0(199),DGH2(1,1))
      DATA CVERT/57.29578/
      DATA CKNOT/.5924838,1.943845/
  999 FORMAT (1H1/1X,'ROTORCRAFT DYNAMICS',10X,18A4/)
  994 FORMAT (1X,'OPERATING STATE',59X,'ROTOR PARAMETERS',13X,'MAIN',5X,-
     1'TAIL')
  993 FORMAT (1X,'OPERATING STATE',59X,'ROTOR PARAMETERS',13X,'FRONT',4X-
     1,'REAR')
  998 FORMAT (6X,'VELOCITY (KNOTS) =',F8.2,10X,'ALTITUDE MSL (FT OR M) =-
     1',F7.0,6X,'TIP SPEED (FPS OR MPS) =',2F9.2)
  997 FORMAT (6X,'V/(OMEGA*R)      =',F8.4,10X,'TEMPERATURE (F OR C) =',-
     1F7.2,9X,'ROTATIONAL SPEED (RPM) =',2F9.2)
  996 FORMAT (6X,'V/(OMEGA*R)      =',F8.4,10X,'STANDARD DAY',25X,'ROTAT-
     1IONAL SPEED (RPM) =',2F9.2)
  995 FORMAT (6X,'THETA-FP (DEG) =',F7.2,13X,'PRESSURE ALT (FT OR M) =',-
     1F7.0,6X,'RADIUS (FT OR M) =',6X,2F9.2/                            -
     26X,'PSI-FP (DEG)   =',F7.2,13X,'AIR DENSITY RATIO =',F7.4,11X,'OME-
     3GA (RAD/SEC)  =',6X,2F9.2/                                        -
     46X,'CLIMB SPEED (FPS OR MPS) =',F7.2,3X,'SOUND SPEED =',F8.2,16X,'-
     5IB (SLUG-FT2 OR KG-M2) =',2F9.2/                                  -
     66X,'SIDE SPEED (FPS OR MPS)  =',F7.2,40X,'NUMBER OF BLADES =',4X,2-
     7I9/6X,'ALTITUDE AGL (FT OR M) =',F8.2,41X,'LOCK NUMBER      =',6X,-
     82F9.3/6X,'GROSS WEIGHT (LB OR KG) =',F8.0,40X,'ROTOR SOLIDITY   ='-
     9,6X,2F9.3)
  984 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',11X,'CNTR',5X,'CNTR')
  983 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',11X,'CNTR',4X,'CLOCK')
  982 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',10X,'CLOCK',5X,'CNTR')
  981 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',10X,'CLOCK',4X,'CLOCK')
  992 FORMAT ( /1X,'OPTIONS'/                                           -
     110X,'OPSYMM =',I2,7X,'IF 1, SYMMETRIC/ IF -1, ANTISYMMETRIC'/     -
     210X,'OPFLOW =',I2,7X,'IF 0, AXIAL FLOW/ LT 0, CONSTANT COEFF/ GT 0-
     3, PERIODIC COEFF'/10X,'OPTRIM =',I2,7X,'IF 0, NO TRIM/ LT 0, NO IT-
     5ERATION/IF 1, TRIM F,M/ IF 2, TRIM F,M,P'/                        -
     610X,'OPMOTR =',I2,7X,'IF 0, AUTOROTATION/ IF 1, CONSTANT SPEED/ IF-
     7 2, MOTOR/ IF 3, POWER OUT'/10X,'OPGOVR =',I2,7X,'IF 0, NO GOVERNO-
     8R'/10X,'OPGRND =',I2,7X,'IF 0, OUT OF GROUND EFFECT'/             -
     A10X,'OPAERO =',I2,7X,'IF 0, NO PERTURBATION AIRCRAFT AERO FORCES'/-
     B10X,'OPMODE =',2I2,5X,'IF 0, RIGID BLADE MODES/IF 2, READ MODES/ I-
     CF 3, PUNCH MODES/ IF 4, ARTICULATED MODES'/10X,'OPAERO =',2I2,5X,'-
     DIF 0, ONLY CLA TERMS IN ROTOR AERO/ LT 0, NO STALL'/              -
     F10X,'OPTORS =',2I2,5X,'IF 0, DOF/ IF 1, RIGID/ IF 2, QUASISTATIC'/-
     G10X,'OPLMDA =',2I2,5X,'IF 0, QUASISTATIC INFLOW DYNAMICS'/        -
     H10X,'OPINTR =',I2,7X,'IF 0, QUASISTATIC AERODYNAMIC INTERFERENCE'/-
     I10X,'OPQRTR =',I2,7X,'IF 1, QUASISTATIC ROTOR-1/ IF 2, ROTOR-2/ IF-
     J 3, BOTH ROTORS/ IF 4, ALL Q-S EXCEPT RIGID BODY')
  980 FORMAT (1X,'SINGLE MAIN ROTOR/TAIL ROTOR CONFIGURATION')
  979 FORMAT (1X,'TANDEM ROTOR CONFIGURATION')
  991 FORMAT (/   1X,'ORDER OF VARIABLES'/10X,'DOF = B0,B1C,B1S,BNC,BNS,-
     1BN/2   T0,T1C,T1S,TNC,TNS,TN/2   BGC,BGS,PSI   L0,LC,LS',10X,'(ROT-
     2OR-1 AND ROTOR-2)'/16X,'PSIE   PHIF,TF,PSIF,XF,YF,ZF   ELASTIC   L-
     3W,LH,LV'/10X,'CON = T0,T1C,T1S,TNC,TNS,TN/2 (ROTOR-1 AND ROTOR-2) -
     4     TT   DF,DE,DA,DF   D0,D1C,D1S,DP,DT'/10X,'GUST = UG,VG,WG')
  989 FORMAT ( /10X,'DOF =',1X,15I1,3X,9I1,3X,3I1,3X,3I1/16X,15I1,3X,9I1-
     1,3X,3I1,3X,3I1,16X,I1,3X,6I1,3X,10I1,3X,3I1/10X,'CON =',1X,8I1,3X,-
     28I1,3X,I1,3X,4I1,3X,5I1/10X,'GUST =',1X,3I1)
  988 FORMAT ( /1X,'COMPUTATION PARAMETERS',15X,'CSYSAN - STEPS =',I4,5X-
     1,'ROOT LOCUS =',I3,7X,'FREQ RESPONSE =',I3/38X,'PSYSAN - STEPS =',-
     2I4,5X,'PLOT MAX =',F7.2,5X,'NUMBER OF FREQ =',I4/38X,'DOF PLOT =',-
     380I1)
  987 FORMAT (38X,'CON AND GUST PLOT =',29I1)
  986 FORMAT (1X,'ENGLISH UNITS (FT, SLUG, SEC)')
  985 FORMAT (1X,'METRIC UNITS (M, KG, SEC)')
      READ (5,NLCYC)
      DO 1 JCYCLE=1,NCYCLE
      VEL=0.
      VKTS=0.
      VTIP=0.
      RPM=0.
      READ (5,NLHL)
      IF ((OPUNIT.NE.1).AND.(OPUNIT.NE.2)) OPUNIT=1
      IF ((RPM .NE. 0.) .AND. (VTIP .EQ. 0.)) VTIP=RADUS1*RPM*.1047198
      IF (VTIP .EQ. 0.) VTIP=VTIPN1
      IF (RPM .EQ. 0.) RPM=VTIP/RADUS1/.1047198
      IF (VEL .EQ. 0.) VEL=VKTS/VTIP/CKNOT(OPUNIT)
      IF (VKTS .EQ. 0.) VKTS=VEL*VTIP*CKNOT(OPUNIT)
      VTIP2=RADUS2/RADUS1*RTRANS*VTIP
      RPM2=RTRANS*RPM
      CALL AIR(ALTMSL,TEMP,DENSE,CSOUND,GRAV,ALTD,OPUNIT)
      CALL HLII(T751,T1C1,T1S1,T752,T1C2,T1S2,1)
      CALL JUGGLE(1)
      CALL RTRII(OPREAD,DEBUG,VTIP,T751,T1C1,T1S1,DENSE,CSOUND,OPUNIT)
      CALL JUGGLE(2)
      CALL RTRII(OPREAD,DEBUG,VTIP2,T752,T1C2,T1S2,DENSE,CSOUND,OPUNIT)
      CALL JUGGLE(3)
      IF ((OPMOTR .NE. 0) .AND. (OPMOTR .NE. 3)) GO TO 120
      PTRIM=0.
      IF (OPTRIM .GT. 0) OPTRIM=2
  120 IF (OPMOTR .EQ. 1) OPGOVR=0
      DO 20 K=1,80
      IF (DOF(K) .NE. 0) DOF(K)=1
      IF (NBLAD1 .NE. 2) GO TO 121
      IF ((K .GE. 11) .AND. (K .LE. 15)) DOF(K)=0
      IF ((K .GE. 22) .AND. (K .LE. 24)) DOF(K)=0
  121 IF (NBLAD2 .NE. 2) GO TO 122
      IF ((K .GE. 41) .AND. (K .LE. 45)) DOF(K)=0
      IF ((K .GE. 52) .AND. (K .LE. 54)) DOF(K)=0
  122 IF (OPSYMM) 221,222,223
  221 IF ((DOFSYM(K) .EQ. 1) .OR. (DOFSYM(K) .EQ. 9)) DOF(K)=0
      GO TO 222
  223 IF ((DOFSYM(K) .EQ.-1) .OR. (DOFSYM(K) .EQ. 9)) DOF(K)=0
  222 IF (K .GT. 26) GO TO 20
      IF (CON(K) .NE. 0) CON(K)=1
      IF ((K .GT. NBLAD1) .AND. (K .LE. 8)) CON(K)=0
      IF ((K .GT. NBLAD2+8) .AND. (K .LE. 16)) CON(K)=0
      IF (OPSYMM) 224,225,226
  224 IF ((CONSYM(K) .EQ. 1) .OR. (CONSYM(K) .EQ. 9)) CON(K)=0
      GO TO 225
  226 IF ((CONSYM(K) .EQ.-1) .OR. (CONSYM(K) .EQ. 9)) CON(K)=0
  225 IF (K .GT. 3) GO TO 20
      IF (GUST(K) .NE. 0) GUST(K)=1
      IF (OPSYMM) 227,20,229
  227 IF ((GUSSYM(K) .EQ. 1) .OR. (GUSSYM(K) .EQ. 9)) GUST(K)=0
      GO TO 20
  229 IF ((GUSSYM(K) .EQ.-1) .OR. (GUSSYM(K) .EQ. 9)) GUST(K)=0
   20 CONTINUE
      IF (NBLAD1 .EQ. 2) DOF(26)=0
      IF (NBLAD2 .EQ. 2) DOF(56)=0
      IF (GIMBL1 .EQ. 0) DOF(25)=0
      IF (GIMBL1 .EQ. 0) DOF(26)=0
      IF (GIMBL2 .EQ. 0) DOF(55)=0
      IF (GIMBL2 .EQ. 0) DOF(56)=0
      IF (OPMOTR .EQ. 1) DOF(27)=0
      IF (OPMOTR .EQ. 1) DOF(57)=0
      IF (OPMOTR .LE. 1) DOF(61)=0
      IF (OPGRND .NE. 0) DOF(28)=1
      IF ((OPGRND .NE. 0) .AND. (ORIENT .EQ. 2)) DOF(58)=1
      IF (OPTORS(1) .EQ. 0) GO TO 123
      DO 124 K=16,24
      IF (OPTORS(1) .EQ. 1) DOF(K)=0
      IF ((OPTORS(1) .EQ. 2) .AND. (K .LE. 15+NBLAD1)) DOF(K)=1
  124 CONTINUE
  123 IF (OPTORS(2) .EQ. 0) GO TO 125
      DO 126 K=46,54
      IF (OPTORS(2) .EQ. 1) DOF(K)=0
      IF ((OPTORS(2) .EQ. 2) .AND. (K .LE. 45+NBLAD2)) DOF(K)=1
  126 CONTINUE
  125 NBM1=0
      DO 22 K=1,5
      DO 22 KB=1,NBLAD1
      J=(K-1)*NBLAD1+KB
      IF (J .GT. 15) GO TO 22
      IF (DOF(J) .NE. 0) NBM1=K
   22 CONTINUE
      NBM1=MAX0(1,NBM1)
      NTM1=0
      DO 24 K=1,3
      DO 24 KB=1,NBLAD1
      J=(K-1)*NBLAD1+KB
      IF (J .GT. 9) GO TO 24
      IF (DOF(J+15) .NE. 0) NTM1=K
   24 CONTINUE
      NTM1=MAX0(1,NTM1)
      NBM2=0
      DO 23 K=1,5
      DO 23 KB=1,NBLAD2
      J=(K-1)*NBLAD2+KB
      IF (J .GT. 15) GO TO 23
      IF (DOF(J+30) .NE. 0) NBM2=K
   23 CONTINUE
      NBM2=MAX0(1,NBM2)
      NTM2=0
      DO 25 K=1,3
      DO 25 KB=1,NBLAD2
      J=(K-1)*NBLAD2+KB
      IF (J .GT. 9) GO TO 25
      IF (DOF(J+45) .NE. 0) NTM2=K
   25 CONTINUE
      NTM2=MAX0(1,NTM2)
      NEM=0
      DO 26 K=1,10
      IF (DOF(K+67) .NE. 0) NEM=K
   26 CONTINUE
      NEM=MAX0(1,NEM)
      MXP=0
      MVP=0
      DO 321 I=1,80
      IF ((I.GE.16).AND.(I.LE.24).AND.(OPTORS(1).EQ.2)) GO TO 321
      IF ((I.GE.28).AND.(I.LE.30).AND.(OPLMDA(1).EQ.0)) GO TO 321
      IF ((I.GE.46).AND.(I.LE.54).AND.(OPTORS(2).EQ.2)) GO TO 321
      IF ((I.GE.58).AND.(I.LE.60).AND.(OPLMDA(2).EQ.2)) GO TO 321
      IF ((I.GE.78).AND.(I.LE.80).AND.(OPINTR.EQ.0)) GO TO 321
      IF ((I.LE.30).AND.(OPQRTR.NE.0).AND.(OPQRTR.NE.2)) GO TO 321
      IF ((I.GE.31).AND.(I.LE.61).AND.(OPQRTR.GE.2)) GO TO 321
      IF ((I.GE.68).AND.(OPQRTR.EQ.4)) GO TO 321
      MXP=MXP+DOF(I)
  321 CONTINUE
      DO 322 I=1,26
      MVP=MVP+CON(I)
      IF (I .LE. 3) MVP=MVP+GUST(I)
  322 CONTINUE
      VCLIMB=VEL*VTIP*SIN(ACLIMB/CVERT)
      VSIDE=VEL*VTIP*COS(ACLIMB/CVERT)*SIN(AYAW/CVERT)
      PRINT 999, (TITLE(I), I=1,18)
      IF (ORIENT .EQ. 1) PRINT 994
      IF (ORIENT .EQ. 2) PRINT 993
      PRINT 998, VKTS,ALTMSL,VTIP,VTIP2
      IF (TEMP .LE. 999.)  PRINT 997, VEL,TEMP,RPM,RPM2
      IF (TEMP .GE. 1000.) PRINT 996, VEL,RPM,RPM2
      PRINT 995, ACLIMB,ALTD,RADUS1,RADUS2,AYAW,DENSE,OMEGA1,OMEGA2,VCLI-
     1MB,CSOUND,IB1,IB2,VSIDE,NBLAD1,NBLAD2,ALTAGL,GAMMA1,GAMMA2,WEIGHT,-
     2SIGMA1,SIGMA2
      IF ((ROTAT1 .EQ.  1) .AND. (ROTAT2 .EQ.  1)) PRINT 984, FSCG
      IF ((ROTAT1 .EQ.  1) .AND. (ROTAT2 .EQ. -1)) PRINT 983, FSCG
      IF ((ROTAT1 .EQ. -1) .AND. (ROTAT2 .EQ.  1)) PRINT 982, FSCG
      IF ((ROTAT1 .EQ. -1) .AND. (ROTAT2 .EQ. -1)) PRINT 981, FSCG
      IF (ORIENT .EQ. 1) PRINT 980
      IF (ORIENT .EQ. 2) PRINT 979
      PRINT 992, OPSYMM,OPFLOW,OPTRIM,OPMOTR,OPGOVR,OPGRND,OPAERO,OPMOD1-
     1,OPMOD2,OPAER1,OPAER2,OPTORS(1),OPTORS(2),OPLMDA(1),OPLMDA(2),OPIN-
     2TR,OPQRTR
      PRINT 991
      PRINT 989, (DOF(I), I=1,80),(CON(I), I=1,26),(GUST(I), I=1,3)
      PRINT 988, JCNST,LOCUS,RESPON,MPER,PLOTMX,NF,(DOFP(I), I=1,MXP)
      PRINT 987, (CONP(I), I=1,MVP)
      IF (OPUNIT .EQ. 1) PRINT 986
      IF (OPUNIT .EQ. 2) PRINT 985
      CALL HLII(T751,T1C1,T1S1,T752,T1C2,T1S2,2)
      CALL JUGGLE(1)
      CALL MODE
      CALL JUGGLE(4)
      CALL MODE
      CALL JUGGLE(5)
      CALL HLTRIM
      IF (TONLY .NE. 0) GO TO 101
      IF (DEBUG .GE. 2) WRITE(6,NLHL)
      GO TO 1
  101 CONTINUE
      PERIOD=6.283185/FLOAT(NBLAD1)
      IF (NBLAD1/2*2 .EQ. NBLAD1) PERIOD=2.*PERIOD
      DT=PERIOD/FLOAT(MPER)
      MT=0
      IF (OPFLOW .GT. 0) MT=MPER
      MT1=MT+1
      NBLD1=NBLAD1
      NBLD2=NBLAD2
      IF (OPFLOW .LT. 0) NBLD1=JCNST
      IF (OPFLOW .LT. 0) NBLD2=JCNST
      DO 2 JT=1,MT1
      NT=JT-1
      PSI=FLOAT(NT)*DT
      CALL JUGGLE(11)
      IF ((NBLAD2.GE.3).AND.(OPFLOW.EQ.0)) CALL ROTOR0
      IF ((NBLAD2.GE.3).AND.(OPFLOW.NE.0)) CALL ROTOR(OPFLOW,PSI,NBLD2)
      IF (NBLAD2 .EQ. 2) CALL ROTOR2(OPFLOW,PSI,NBLD2)
      CALL JUGGLE(10)
      IF ((NBLAD1.GE.3).AND.(OPFLOW.EQ.0)) CALL ROTOR0
      IF ((NBLAD1.GE.3).AND.(OPFLOW.NE.0)) CALL ROTOR(OPFLOW,PSI,NBLD1)
      IF (NBLAD1 .EQ. 2) CALL ROTOR2(OPFLOW,PSI,NBLD1)
      CALL HLBODY
      CNSTO=OMEGA1/OMEGA2
      CNSTO2=CNSTO**2
      CNSTR=RADUS1/RADUS2
      CNSTOR=CNSTO*CNSTR
      CNSTM=(FLOAT(NBLAD2)*IB2*OMEGA2**2)/(FLOAT(NBLAD1)*IB1*OMEGA1**2)
      CNSTF=CNSTM*CNSTR
      DO 431 K=1,30
      DO 432 I=1,30
      A2R2(K,I)=A2R2(K,I)*CNSTO2
  432 A1R2(K,I)=A1R2(K,I)*CNSTO
      DO 431 I=1,6
      AA2R2(K,I)=AA2R2(K,I)*CNSTO2
      AA1R2(K,I)=AA1R2(K,I)*CNSTO
      IF (I .LE. 3) BGR2(K,I)=BGR2(K,I)*CNSTOR
  431 CONTINUE
      DO 433 K=1,6
      DO 434 I=1,30
      C2R2(K,I)=C2R2(K,I)*CNSTO2
  434 C1R2(K,I)=C1R2(K,I)*CNSTO
      DO 433 I=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTO2
      CA1R2(K,I)=CA1R2(K,I)*CNSTO
      IF (I .LE. 3) DGR2(K,I)=DGR2(K,I)*CNSTOR
  433 CONTINUE
      DO 435 I=1,3
      DO 436 K=1,30
      AA2R2(K,I)=AA2R2(K,I)*CNSTR
      AA1R2(K,I)=AA1R2(K,I)*CNSTR
  436 AA0R2(K,I)=AA0R2(K,I)*CNSTR
      DO 435 K=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTR
      CA1R2(K,I)=CA1R2(K,I)*CNSTR
  435 CA0R2(K,I)=CA0R2(K,I)*CNSTR
      DO 437 K=1,3
      DO 438 I=1,30
      C2R2(K,I)=C2R2(K,I)*CNSTF
      C1R2(K,I)=C1R2(K,I)*CNSTF
      C0R2(K,I)=C0R2(K,I)*CNSTF
      C2R2(K+3,I)=C2R2(K+3,I)*CNSTM
      C1R2(K+3,I)=C1R2(K+3,I)*CNSTM
  438 C0R2(K+3,I)=C0R2(K+3,I)*CNSTM
      DO 437 I=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTF
      CA1R2(K,I)=CA1R2(K,I)*CNSTF
      CA0R2(K,I)=CA0R2(K,I)*CNSTF
      CA2R2(K+3,I)=CA2R2(K+3,I)*CNSTM
      CA1R2(K+3,I)=CA1R2(K+3,I)*CNSTM
      CA0R2(K+3,I)=CA0R2(K+3,I)*CNSTM
      IF (I .GT. 3) GO TO 437
      DGR2(K,I)=DGR2(K,I)*CNSTF
      DGR2(K+3,I)=DGR2(K+3,I)*CNSTM
  437 CONTINUE
      DO 131 I=1,3
      DO 132 K=1,30
      BGH1(K,I)=0.
      BGH2(K,I)=0.
      DO 132 J=1,3
      BGH1(K,I)=BGH1(K,I)+BGR1(K,J)*RSV1(J,I)
  132 BGH2(K,I)=BGH2(K,I)+BGR2(K,J)*RSV2(J,I)
      DO 133 K=1,6
      DGH1(K,I)=0.
      DGH2(K,I)=0.
      DO 133 J=1,3
      DGH1(K,I)=DGH1(K,I)+DGR1(K,J)*RSV1(J,I)
  133 DGH2(K,I)=DGH2(K,I)+DGR2(K,J)*RSV2(J,I)
  131 CONTINUE
      DO 134 I=1,3
      DO 135 K=1,30
      BGR1(K,I)=BGH1(K,I)
  135 BGR2(K,I)=BGH2(K,I)
      DO 134 K=1,6
      DGR1(K,I)=DGH1(K,I)
  134 DGR2(K,I)=DGH2(K,I)
      DO 136 I=1,3
      DO 136 K=1,16
      BGH1(K,I)=0.
      DO 136 J=1,3
  136 BGH1(K,I)=BGH1(K,I)+BGW(K,J)*RFV(J,I)
      DO 137 I=1,3
      DO 137 K=1,16
  137 BGW(K,I)=BGH1(K,I)
      DO 31 I=1,6400
      A2(I)=0.
      A1(I)=0.
   31 A0(I)=0.
      DO 32 I=1,2320
   32 B0(I)=0.
      DO 33 I=1,30
      DO 33 K=1,30
      JA=(I-1)*80+K
      A2(JA)=A2R1(K,I)
      A1(JA)=A1R1(K,I)
      A0(JA)=A0R1(K,I)
      JA=(I+29)*80+K+30
      A2(JA)=A2R2(K,I)
      A1(JA)=A1R2(K,I)
   33 A0(JA)=A0R2(K,I)
      DO 34 I=1,8
      DO 34 K=1,30
      JB=(I-1)*80+K
      B(JB)=BR1(K,I)
      JB=(I+7)*80+K+30
   34 B(JB)=BR2(K,I)
      DO 35 I=1,3
      DO 35 K=1,30
      JB=(I-1)*80+K
      BG(JB)=BGR1(K,I)
   35 BG(JB+30)=BGR2(K,I)
      DO 41 I=1,16
      DO 41 K=1,30
      JA1=(I+60)*80+K
      JA2=JA1+30
      DO 41 J=1,6
      A2(JA1)=A2(JA1)+AA2R1(K,J)*CAW(J,I)
      A2(JA2)=A2(JA2)+AA2R2(K,J)*CAW(J+6,I)
      A1(JA1)=A1(JA1)+AA1R1(K,J)*CAW(J,I)
      A1(JA2)=A1(JA2)+AA1R2(K,J)*CAW(J+6,I)
      IF (I .LE. 3) GO TO 41
      A0(JA1)=A0(JA1)+AA0R1(K,J)*CAW(J,I)
      A0(JA2)=A0(JA2)+AA0R2(K,J)*CAW(J+6,I)
   41 CONTINUE
      DO 42 I=1,30
      DO 42 K=1,16
      JA1=(I-1)*80+K+61
      JA2=(I+29)*80+K+61
      DO 42 J=1,6
      A2(JA1)=A2(JA1)-AAW(K,J)*C2R1(J,I)
      A1(JA1)=A1(JA1)-AAW(K,J)*C1R1(J,I)
      A0(JA1)=A0(JA1)-AAW(K,J)*C0R1(J,I)
      A2(JA2)=A2(JA2)-AAW(K,J+6)*C2R2(J,I)
      A1(JA2)=A1(JA2)-AAW(K,J+6)*C1R2(J,I)
   42 A0(JA2)=A0(JA2)-AAW(K,J+6)*C0R2(J,I)
      DO 43 I=1,6
      DO 43 K=1,16
      C2H(K,I)=0.
      C1H(K,I)=0.
      C0H(K,I)=0.
      C2H(K,I+6)=0.
      C1H(K,I+6)=0.
      C0H(K,I+6)=0.
      DO 43 J=1,6
      C1H(K,I)=C1H(K,I)+AAW(K,J)*CA1R1(J,I)
      C0H(K,I)=C0H(K,I)+AAW(K,J)*CA0R1(J,I)
      C1H(K,I+6)=C1H(K,I+6)+AAW(K,J+6)*CA1R2(J,I)
      C0H(K,I+6)=C0H(K,I+6)+AAW(K,J+6)*CA0R2(J,I)
      IF ((I .LE. 3) .OR. (J .LE. 3)) GO TO 43
      C2H(K,I)=C2H(K,I)+AAW(K,J)*CA2R1(J,I)
      C2H(K,I+6)=C2H(K,I+6)+AAW(K,J+6)*CA2R2(J,I)
   43 CONTINUE
      DO 44 I=1,19
      DO 44 K=1,16
      JA=(I+60)*80+K+61
      A2(JA)=A2W(K,I)
      A1(JA)=A1W(K,I)
      A0(JA)=A0W(K,I)
      IF (I .GT. 16) GO TO 44
      DO 48 J=1,12
      A2(JA)=A2(JA)-C2H(K,J)*CAW(J,I)
      A1(JA)=A1(JA)-C1H(K,J)*CAW(J,I)
      IF (I .LE. 3) GO TO 48
      A0(JA)=A0(JA)-C0H(K,J)*CAW(J,I)
   48 CONTINUE
   44 CONTINUE
      DO 45 I=1,3
      DO 45 K=1,30
      JA1=(I+60)*80+K
      JA2=JA1+30
      DO 45 J=1,3
      A1(JA1)=A1(JA1)+AA2R1(K,J)*CB1W(J,I)
      A1(JA2)=A1(JA2)+AA2R2(K,J)*CB2W(J,I)
      IF (K .GT. 16) GO TO 45
      A1(JA2+31)=A1(JA2+31)-C2H(K,J)*CB1W(J,I)-C2H(K,J+6)*CB2W(J,I)
   45 CONTINUE
      DO 46 I=1,4
      DO 46 K=1,16
      JB=(I+16)*80+K+61
   46 B(JB)=BW(K,I)
      DO 47 I=1,3
      DO 47 K=1,16
      JB=(I-1)*80+K+61
      BG(JB)=BGW(K,I)
      DO 47 J=1,6
   47 BG(JB)=BG(JB)+AAW(K,J)*DGR1(J,I)+AAW(K,J+6)*DGR2(J,I)
      CNSTL1=SQRT((MU1**2+MUY1**2)/KFLMD1**2+LMDA01**2/KHLMD1**4)
      CNSTL1=GAMMA1/(SIGMA1*5.7)*DENSE*2.*(CNSTL1+(LMDA01-MUZ1)*LMDA01/K-
     1HLMD1**4/CNSTL1)
      CNSTL2=SQRT((MU2**2+MUY2**2)/KFLMD2**2+LMDA02**2/KHLMD2**4)
      CNSTL2=GAMMA2/(SIGMA2*5.7)*DENSE*2.*(CNSTL2+(LMDA02-MUZ2)*LMDA02/K-
     1HLMD2**4/CNSTL2)
      CNST12=K12L/CNSTOR*CNSTL1/CNSTL2
      CNST21=K21L*CNSTOR/CNSTL1*CNSTL2
      DO 241 I=1,80
      JA1=(I-1)*80+28
      JA2=JA1+30
      HOLD=A1(JA1)
      A1(JA1)=HOLD+CNST12*A1(JA2)
      A1(JA2)=A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=HOLD+CNST12*A0(JA2)
      A0(JA2)=A0(JA2)+CNST21*HOLD
      IF (I .GT. 3) GO TO 241
      HOLD=BG(JA1)
      BG(JA1)=HOLD+CNST12*BG(JA2)
      BG(JA2)=BG(JA2)+CNST21*HOLD
  241 CONTINUE
      CNST1=GAMMA1/(SIGMA1*5.7)*DENSE
      A2(2188)=A2(2188)+.85*CNST1
      A2(2269)=A2(2269)+.22*CNST1
      A2(2350)=A2(2350)+.22*CNST1
      CNST1=CNST1*SQRT((MU1**2+MUY1**2)/KFLMD1**2+LMDA01**2/KHLMD1**4)
      A1(2269)=A1(2269)+CNST1
      A1(2350)=A1(2350)+CNST1
      A1(2188)=A1(2188)+CNSTL1
      CNST1=GAMMA2/(SIGMA2*5.7)*DENSE
      A2(4618)=A2(4618)+.85*CNST1
      A2(4699)=A2(4699)+.22*CNST1
      A2(4780)=A2(4780)+.22*CNST1
      CNST1=CNST1*SQRT((MU2**2+MUY2**2)/KFLMD2**2+LMDA02**2/KHLMD2**4)
      A1(4699)=A1(4699)+CNST1
      A1(4780)=A1(4780)+CNST1
      A1(4618)=A1(4618)+CNSTL2
      IF (OPMOTR .LE. 1) GO TO 140
      IF (ENGPOS .EQ. 2) GO TO 141
      CNST1=1.
      CNST12=RTRANS
      CNST21=0.
      CNST2=1.
      GO TO 142
  141 CNST1=1./RTRANS
      CNST12=1.
      CNST21=1.
      CNST2=0.
  142 DO 143 I=1,80
      JA1=I+2080
      JA2=I+4480
      HOLD=A2(JA1)
      A2(JA1)=CNST1*HOLD+CNST12*A2(JA2)
      A2(JA2)=CNST2*A2(JA2)+CNST21*HOLD
      HOLD=A1(JA1)
      A1(JA1)=CNST1*HOLD+CNST12*A1(JA2)
      A1(JA2)=CNST2*A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=CNST1*HOLD+CNST12*A0(JA2)
  143 A0(JA2)=CNST2*A0(JA2)+CNST21*HOLD
      IF (ENGPOS .EQ. 2) GO TO 144
      CNST1=1.
      CNST12=RTRANS*CNSTM
      CNST21=-RTRANS*KMAST2*KICS/(KMAST1*(KMAST2+KICS))
      CNST2=CNSTM
      GO TO 145
  144 CNST1=1./RTRANS
      CNST12=CNSTM
      CNST21=1.
      CNST2=-CNSTM/RTRANS*KMAST1*KICS/(KMAST2*(KMAST1+KICS))
  145 DO 146 I=1,80
      JA1=(I-1)*80+27
      JA2=JA1+30
      HOLD=A2(JA1)
      A2(JA1)=CNST1*HOLD+CNST12*A2(JA2)
      A2(JA2)=CNST2*A2(JA2)+CNST21*HOLD
      HOLD=A1(JA1)
      A1(JA1)=CNST1*HOLD+CNST12*A1(JA2)
      A1(JA2)=CNST2*A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=CNST1*HOLD+CNST12*A0(JA2)
      A0(JA2)=CNST2*A0(JA2)+CNST21*HOLD
      IF (I .GT. 3) GO TO 146
      HOLD=BG(JA1)
      BG(JA1)=CNST1*HOLD+CNST12*BG(JA2)
      BG(JA2)=CNST2*BG(JA2)+CNST21*HOLD
  146 CONTINUE
      CIENG=IENG/(FLOAT(NBLAD1)*IB1)
      CNST1=FLOAT(NBLAD1)*IB1*OMEGA1**2
      IF (ENGPOS .EQ. 2) GO TO 147
      CKMM=KMAST1*KMAST2+KICS*(KMAST1+KMAST2*RTRANS**2)
      CKMI=KMAST2*KICS/(KMAST2+KICS)/CNST1
      CKEM=KENG*CKMM/(KENG*(KMAST2+KICS)+CKMM)/CNST1
      CKEI=KENG*RTRANS**2*KMAST2*KICS/(KENG*(KMAST2+KICS)+CKMM)/CNST1
      GO TO 148
  147 CKMM=KMAST1*KMAST2+KICS*(KMAST2+KMAST1/RTRANS**2)
      CKMI=KMAST1*KICS/(KMAST1+KICS)/CNST1
      CKEM=KENG*CKMM/(KENG*(KMAST1+KICS)+CKMM)/CNST1
      CKEI=KENG/RTRANS**2*KMAST1*KICS/(KENG*(KMAST1+KICS)+CKMM)/CNST1
  148 A2(2107)=A2(2107)+CIENG
      A2(4827)=A2(4827)+CIENG
      A1(2107)=A1(2107)+EDAMP
      A1(4827)=A1(4827)+EDAMP
      B(1307)=B(1307)+QTHRTL
      A0(4537)=A0(4537)+CKMI
      A2(2141)=A2(2141)+CIENG
      A2(4861)=A2(4861)+CIENG
      A1(2141)=A1(2141)+EDAMP
      A1(4861)=A1(4861)+EDAMP
      A0(4861)=A0(4861)+CKEM
      A0(4541)=A0(4541)-CKEI
      B(1341)=B(1341)+QTHRTL
  140 A2(6238)=TAUW
      A2(6319)=TAUH
      A2(6400)=TAUV
      A1(6238)=1.
      A1(6319)=1.
      A1(6400)=1.
      A1(2238)=CWRTR1
      A1(4638)=CWRTR2
      A1(2239)=CHRTR1
      A1(4639)=CHRTR2
      A1(2240)=CVRTR1
      A1(4640)=CVRTR2
      IF (OPGRND .EQ. 0) GO TO 242
      GLMDA1=(LMDA01-MUZ1)/(1.-(CSEGE1*.25/ZAGL1)**2)
      GLMDA2=(LMDA02-MUZ2)/(1.-(CSEGE2*.25/ZAGL2)**2)
      DLDZ1=CNSTL1*GLMDA1*CSEGE1**2*.125/ZAGL1**3
      DLDZ2=CNSTL2*GLMDA2*CSEGE2**2*.125/ZAGL2**3*RADUS1/RADUS2
      SNT=SIN(THETAF)
      CST=COS(THETAF)
      SNP=SIN(PHIF)
      CSP=COS(PHIF)
      A0(4908)=A0(4908)-DLDZ1*(ZRTR1*SNP-YRTR1*CSP)*CST
      A0(4938)=A0(4938)-DLDZ2*(ZRTR2*SNP-YRTR2*CSP)*CST
      A0(4988)=A0(4988)-DLDZ1*((ZRTR1*CSP+YRTR1*SNP)*SNT+XRTR1*CST)
      A0(5018)=A0(5018)-DLDZ2*((ZRTR2*CSP+YRTR2*SNP)*SNT+XRTR2*CST)
      A0(5148)=A0(5148)-DLDZ1*SNT
      A0(5178)=A0(5178)-DLDZ2*SNT
      A0(5228)=A0(5228)+DLDZ1*CST*SNP
      A0(5258)=A0(5258)+DLDZ2*CST*SNP
      A0(5308)=A0(5308)+DLDZ1*CST*CSP
      A0(5338)=A0(5338)+DLDZ2*CST*CSP
      DO 243 I=1,NEM
      JA1=(I+66)*80+28
      JA2=JA1+30
      A0(JA1)=A0(JA1)+DLDZ1*(-ZETAR1(1,I)*SNT+ZETAR1(2,I)*CST*SNP+ZETAR1-
     1(3,I)*CST*CSP)
  243 A0(JA2)=A0(JA2)+DLDZ2*(-ZETAR2(1,I)*SNT+ZETAR2(2,I)*CST*SNP+ZETAR2-
     1(3,I)*CST*CSP)
  242 IF ((NBLAD1 .NE. 2) .AND. (NBLAD2 .NE. 2)) GO TO 159
      CSPSI=COS(PSI)
      SNPSI=SIN(PSI)
  159 IF (OPTORS(1) .EQ. 1) GO TO 153
      CNSTC=B(97)*RADUS1
      CNSTS=B(178)*RADUS1
      IF (NBLAD1 .EQ. 2) GO TO 151
      DO 152 I=1,NEM
      JA=(I+66)*80+17
      A0(JA)=A0(JA)+CNSTC*KPMC1(I)
  152 A0(JA+1)=A0(JA+1)+CNSTS*KPMS1(I)
      GO TO 153
  151 DO 154 I=1,NEM
      JA=(I+66)*80+17
  154 A0(JA)=A0(JA)+CNSTC*KPMC1(I)*CSPSI+CNSTC*KPMS1(I)*SNPSI
  153 IF (OPTORS(2) .EQ. 1) GO TO 157
      CNSTC=B(767)*RADUS1
      CNSTS=B(848)*RADUS1
      IF (NBLAD2 .EQ. 2) GO TO 155
      DO 156 I=1,NEM
      JA=(I+66)*80+47
      A0(JA)=A0(JA)+CNSTC*KPMC2(I)
  156 A0(JA+1)=A0(JA+1)+CNSTS*KPMS2(I)
      GO TO 157
  155 DO 158 I=1,NEM
      JA=(I+66)*80+47
  158 A0(JA)=A0(JA)+CNSTC*KPMC2(I)*CSPSI+CNSTC*KPMS2(I)*SNPSI
  157 IF (OPTORS(1) .NE. 1) GO TO 50
      JN=80*NBLAD1
      DO 252 J=1,JN
  252 B(J)=-A0(J+1200)
      DO 253 I=1,NBM1
      DO 253 J=1,JN
      JA=(I-1)*JN+J
      IF (JA .GT. 1200) GO TO 253
      A0(JA)=A0(JA)-KPB1(I)*A0(J+1200)
  253 CONTINUE
      IF (GIMBL1 .EQ. 0) GO TO 254
      JN=160
      IF (NBLAD1 .EQ. 2) JN=80
      DO 255 J=1,JN
  255 A0(J+1920)=A0(J+1920)-KPG1*A0(J+1280)
  254 CNST1=1.
      CNST2=0.
      IF (ENGPOS .EQ. 2) CNST1=1./RTRANS
      IF (ENGPOS .EQ. 2) CNST2=1.
      IF (NBLAD1 .EQ. 2) GO TO 257
      DO 258 J=1,80
      HOLD=TRS1*A0(J+1280)-TRC1*A0(J+1360)
      A0(J+2080)=A0(J+2080)+CNST1*HOLD
  258 A0(J+4480)=A0(J+4480)+CNST2*HOLD
      GO TO 256
  257 TCYC=-TRC1*SNPSI+TRS1*CSPSI
      DO 259 J=1,80
      A0(J+2080)=A0(J+2080)+CNST1*TCYC*A0(J+1280)
  259 A0(J+4480)=A0(J+4480)+CNST2*TCYC*A0(J+1280)
  256 IF (NBLAD1 .EQ. 2) GO TO 250
      DO 251 I=1,NEM
      DO 251 J=1,80
      JA=(I+66)*80+J
  251 A0(JA)=A0(JA)-(KPMC1(I)*A0(J+1280)+KPMS1(I)*A0(J+1360))*RADUS1
      GO TO 50
  250 DO 1252 I=1,NEM
      DO 1252 J=1,80
      JA=(I+66)*80+J
 1252 A0(JA)=A0(JA)-(KPMC1(I)*CSPSI+KPMS1(I)*SNPSI)*A0(J+1280)*RADUS1
   50 IF (OPTORS(2) .NE. 1) GO TO 51
      JN=80*NBLAD2
      DO 352 J=1,JN
  352 B(J+640)=-A0(J+3600)
      DO 353 I=1,NBM2
      DO 353 J=1,JN
      JA=(I+29)*JN+J
      IF (JA .GT. 3600) GO TO 353
      A0(JA)=A0(JA)-KPB2(I)*A0(J+3600)
  353 CONTINUE
      IF (GIMBL2 .EQ. 0) GO TO 354
      JN=160
      IF (NBLAD2 .EQ. 2) JN=80
      DO 355 J=1,JN
  355 A0(J+4320)=A0(J+4320)-KPG2*A0(J+3680)
  354 CNST1=RTRANS
      CNST2=1.
      IF (ENGPOS .EQ. 2) CNST1=1.
      IF (ENGPOS .EQ. 2) CNST2=0.
      IF (NBLAD2 .EQ. 2) GO TO 357
      DO 358 J=1,80
      HOLD=TRS2*A0(J+3680)-TRC2*A0(J+3760)
      A0(J+2080)=A0(J+2080)+CNST1*HOLD
  358 A0(J+4480)=A0(J+4480)+CNST2*HOLD
      GO TO 356
  357 TCYC=-TRC2*SNPSI+TRS2*CSPSI
      DO 359 J=1,80
      A0(J+2080)=A0(J+2080)+CNST1*TCYC*A0(J+3680)
  359 A0(J+4480)=A0(J+4480)+CNST2*TCYC*A0(J+3680)
  356 IF (NBLAD2 .EQ. 2) GO TO 350
      DO 351 I=1,NEM
      DO 351 J=1,80
      JA=(I+66)*80+J
  351 A0(JA)=A0(JA)-(KPMC2(I)*A0(J+3680)+KPMS2(I)*A0(J+3760))*RADUS1
      GO TO 51
  350 DO 1352 I=1,NEM
      DO 1352 J=1,80
      JA=(I+66)*80+J
 1352 A0(JA)=A0(JA)-(KPMC2(I)*CSPSI+KPMS2(I)*SNPSI)*A0(J+3680)*RADUS1
   51 IF (OPGOVR .EQ. 0) GO TO 52
      DO 53 I=1,80
      CNSTB=KIR1GV*B(I)+KIR2GV*B(I+640)+KIEGOV*B(I+1280)
      A0(I+2080)=A0(I+2080)-CNSTB
      A0(I+4800)=A0(I+4800)-CNSTB
      CNSTB=(KPR1GV*B(I)+KPR2GV*B(I+640)+KPEGOV*B(I+1280))*OMEGA1
      A1(I+2080)=A1(I+2080)-CNSTB
   53 A1(I+4800)=A1(I+4800)-CNSTB
   52 DO 331 I=1,5
      DO 331 K=1,80
      DO 331 J=1,11
      JB=(I+20)*80+K
      J1=(J-1)*80+K
      IF (J .GE. 4) J1=J1+400
      IF (J .GE. 7) J1=J1+400
  331 B(JB)=B(JB)+B(J1)*TCFE(J,I)
      MX=0
      MX1=0
      MX0=0
      MV=0
      MVG=0
      DO 60 I=1,80
      MX=MX+DOF(I)
      DOF1(I)=1
   60 DOF0(I)=1
      IF  (OPFLOW .NE. 0) GO TO 69
      IF ((OPGOVR.NE.0) .AND. ((KIR1GV.NE.0.).OR.(KIR2GV.NE.0.).OR.(KIEG-
     1OV.NE.0.))) GO TO 69
      DOF1(27)=0
      IF (DOF(27) .NE. 0)  MX1=MX1+1
   69 DO 63 I=28,30
      DOF1(I)=0
      IF (DOF(I) .EQ. 0) GO TO 163
      MX1=MX1+1
      IF (OPLMDA(1) .NE. 0) GO TO 163
      DOF0(I)=0
      MX0=MX0+1
  163 DOF1(I+30)=0
      IF (DOF(I+30) .EQ. 0) GO TO 63
      MX1=MX1+1
      IF (OPLMDA(2) .NE. 0) GO TO 63
      DOF0(I+30)=0
      MX0=MX0+1
   63 CONTINUE
      DO 64 I=78,80
      DOF1(I)=0
      IF (DOF(I) .EQ. 0) GO TO 64
      MX1=MX1+1
      IF (OPINTR .NE. 0) GO TO 64
      DOF0(I)=0
      MX0=MX0+1
   64 CONTINUE
      IF (OPTORS(1) .NE. 2) GO TO 65
      DO 66 I=16,24
      IF (DOF(I) .EQ. 0) GO TO 66
      DOF0(I)=0
      MX0=MX0+1
   66 CONTINUE
   65 IF (OPTORS(2) .NE. 2) GO TO 67
      DO 68 I=46,54
      IF (DOF(I) .EQ. 0) GO TO 68
      DOF0(I)=0
      MX0=MX0+1
   68 CONTINUE
   67 IF ((A0(5148).EQ.0.).AND.(A0(5178).EQ.0.)) DOF1(65)=0
      IF ((A0(5228).EQ.0.).AND.(A0(5258).EQ.0.)) DOF1(66)=0
      IF ((A0(5308).EQ.0.).AND.(A0(5338).EQ.0.)) DOF1(67)=0
      DOF1(64)=0
      DO 167 I=64,67
      IF ((DOF1(I) .EQ. 0) .AND. (DOF(I) .EQ. 1)) MX1=MX1+1
  167 CONTINUE
      IF (OPQRTR .EQ. 0) GO TO 261
      IF (OPQRTR .EQ. 2) GO TO 262
      DO 263 I=1,30
      IF (DOF(I) .EQ. 0) GO TO 263
      IF (DOF0(I) .EQ. 0) GO TO 263
      DOF0(I)=0
      MX0=MX0+1
  263 CONTINUE
  262 IF (OPQRTR .EQ. 1) GO TO 264
      DO 265 I=31,61
      IF (DOF(I) .EQ. 0) GO TO 265
      IF (DOF0(I) .EQ. 0) GO TO 265
      DOF0(I)=0
      MX0=MX0+1
  265 CONTINUE
  264 IF (OPQRTR .NE. 4) GO TO 261
      DO 266 I=68,80
      IF (DOF(I) .EQ. 0) GO TO 266
      IF (DOF0(I) .EQ. 0) GO TO 266
      DOF0(I)=0
      MX0=MX0+1
  266 CONTINUE
  261 DO 61 I=1,26
   61 MV=MV+CON(I)
      DO 62 I=1,3
   62 MVG=MVG+GUST(I)
      CALL DERED(80,26,3,DOF,CON,GUST,A2,A1,A0,B,BG,DOF1,DOF0)
      MVX=MX*MV
      MVGX=MX*MVG
      DO 160 I=1,MVGX
      I1=I+MVX
  160 B0(I1)=BG(I)
      MV=MV+MVG
      IF (MX0 .NE. 0) CALL QSTRAN(MX,MX0,MX1,MV,A2,A1,A0,B0,DOF1,DOF0)
      IF (DEBUG .EQ. 0) GO TO 81
      MXSQ1=MX*MX+1
      IF (MXSQ1 .GT. 6400) GO TO 82
      DO 83 I=MXSQ1,6400
      A2(I)=0.
      A1(I)=0.
   83 A0(I)=0.
   82 MVX1=MX*MV+1
      IF (MVX1 .GT. 2320) GO TO 81
      DO 85 I=MVX1,2320
   85 B0(I)=0.
   81 IF (DEBUG .GE. 2) WRITE(6,NLHL)
      IF (DEBUG .EQ. 3) WRITE(6,NLR)
      IF (DEBUG .EQ. 3) WRITE(6,NLS)
      IF ((DEBUG.EQ.1).OR.(DEBUG.EQ.3)) WRITE(6,NLEQ)
      IF (OPFLOW .GT. 0) GO TO 3
      CALL CSYSAN(NSYSAN,MX,MX1,MV,A2,A1,A0,B0,NFREQ,FREQ,NSTEP,DOF1,OME-
     1GA1)
      IF (LOCUS .GT. 0) CALL RPLOT(MX,MX1,JCYCLE,PLOTMX,LOCUS)
      IF ((RESPON.GT.0).AND.(LOCUS.LE.0)) CALL TRANS(B0,MX,MX1,MV,RESPON-
     1,NF,DOFP,CONP)
      GO TO 2
    3 NSYSAN=0
      CALL PSYSAN(NSYSAN,MX,MX1,A2,A1,A0,PHI,DT,NT,MT,PERIOD,MT,DOF1)
    2 CONTINUE
    1 CONTINUE
      IF ((LOCUS .GT. 0) .OR. (RESPON .GT. 0)) CALL ENPLT(10.,0.)
      STOP
      END
      SUBROUTINE HLII(T751,T1C1,T1S1,T752,T1C2,T1S2,N)
      COMMON /HINPUT/TITLE(18),VTIP,RPM,VEL,VKTS,OPUNIT,ALTMSL,TEMP,ALTA-
     1GL,ACLIMB,AYAW,APITCH,AROLL,COLL,LNGCYC,LATCYC,PEDAL,WEIGHT,AFLAP,-
     2ITER,EPTRIM,FACTOR,PTRIM,DOF(80),CON(26),GUST(3),OPSYMM,DOFSYM(80)-
     3,CONSYM(26),GUSSYM(3),OPFLOW,OPTORS(2),OPMOTR,OPLMDA(2),OPINTR,OPQ-
     4RTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,TONLY,MPER,JCNST,NSYS-
     5AN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP(80),CONP(29),CNTRL0,CNT-
     6RLC,CNTRLS,CNTRLP,THETFP,PSIFP,THETAF,PHIF,VELX,VELY,VELZ,GRAV,DEN-
     7SE,CSOUND,FREQ(100)
      COMMON /GINPUT/ORIENT,ASHAFT(2),ACANT(2),K12H,K12F,K12L,K21H,K21F,-
     1K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR-
     22,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,TAUH,TAUV,RTRANS,IENG,KMAST1,KM-
     3AST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,TH-
     4RTLC,NRPOWR,EDAMPC,KPMC1(10),KPMS1(10),KPMC2(10),KPMS2(10),FSR1,WL-
     5R1,BLR1,FSR2,WLR2,BLR2,FSCG,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX-
     6,IYY,IZZ,IXZ,XRTR1,YRTR1,ZRTR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,X-
     7VT,ZVT,AMASS,AIXX,AIYY,AIZZ,AIXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCF-
     8E,PRCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCC-
     9FE,PSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ(11),TCFE-
     A(11,5),QMASS(10),QFREQ(10),QDAMP(10),ZETAR1(3,10),ZETAR2(3,10),GAM-
     BAR1(3,10),GAMAR2(3,10),NEM,RSF1(3,3),RSF2(3,3),RFV(3,3),RSV1(3,3),-
     CRSV2(3,3),ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,EDAMP,QTHRTL
      INTEGER OPUNIT,ORIENT,DOF,CON,GUST,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPF-
     1LOW,OPTORS,OPMOTR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND-
     2,OPAERO,DEBUG,TONLY,RESPON,DOFP,CONP,ENGPOS
      REAL LNGCYC,LATCYC,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWR-
     1TR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,IENG,KMAST1,KMAST2,KICS,KENG,KPR1G-
     2V,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,NRPOWR,KPMC1,KPMC2,KPMS1,KPMS-
     32,IXX,IYY,IZZ,IXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,KF0CFE,KR0CFE,KFSCFE-
     4,KRSCFE,KCCFE,KSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,LMDA-
     501,LMDA02
      COMMON /R1DATA/HHR1(667)
      EQUIVALENCE (RADIUS,HHR1(14)),(ROTATE,HHR1(663)),(GAMMA,HHR1(12)),-
     1(SIGMA,HHR1(15))
      INTEGER ROTATE
      COMMON   /FINPUT/LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,D-
     1RG0W,DRGDW,DRGFW,DRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB-
     2,SPANW,AREAW,CHORDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,-
     3LFTEH,AMAXH,IHT,SPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,EZZ(10,10),EXX(1-
     40,10),EZX(10,10),EXZ(10,10),EZ(10),EX(10),ET(10),EZT(10,10),EXT(10-
     5,10),ETT(10,10),EZD(10),EXD(10),EZL(10),EXL(10),ETL(10),FZH(10),FX-
     6H(10),FTH(10),FYW(10),FFH(10),FYV(10),FFV(10),FPV(10)
      REAL LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,KCLB,IWB,LFLA-
     1PO,LFLAPI,LAILO,LAILI,LFTAH,LFTEH,IHT,LFTAV,LFTEV,IVT
      COMMON /FEDATA/EZZN(10,10),EXXN(10,10),EZXN(10,10),EXZN(10,10),EZN-
     1(10),EXN(10),ETN(10),EZTN(10,10),EXTN(10,10),ETTN(10,10),EZDN(10),-
     2EXDN(10),EZLN(10),EXLN(10),ETLN(10),FZHN(10),FXHN(10),FTHN(10),FYW-
     3N(10),FFHN(10),FYVN(10),FFVN(10),FPVN(10),IDENT(10)
      COMMON /FADATA/AAD(48)
      DIMENSION AAH(39),EEDN(86)
      EQUIVALENCE (AAH(1),LFTAW),(EEDN(1),EZZN(1,1))
      DIMENSION CGW(2)
      NAMELIST /NLFUSE/LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,D-
     1RG0W,DRGDW,DRGFW,DRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB-
     2,SPANW,AREAW,CHORDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,-
     3LFTEH,AMAXH,IHT,SPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,EZZ,EXX,EZX,EXZ,-
     4EZ,EX,ET,EZT,EXT,ETT,EZD,EXD,EZL,EXL,ETL,FZH,FXH,FTH,FYW,FFH,FYV,F-
     5FV,FPV
      DATA CVERT/57.29578/
      DATA CGW/32.17405,1./
      GO TO (1,2),N
    1 THETAF=APITCH/CVERT
      PHIF=AROLL/CVERT
      THETFP=ACLIMB/CVERT
      PSIFP=AYAW/CVERT
      CNTRL0=COLL/CVERT
      CNTRLC=LATCYC/CVERT
      CNTRLS=LNGCYC/CVERT
      CNTRLP=PEDAL/CVERT
      AMASS=WEIGHT/CGW(OPUNIT)
      AIXX=IXX
      AIYY=IYY
      AIZZ=IZZ
      AIXZ=IXZ
      XRTR1=(FSCG-FSR1)/RADIUS
      XRTR2=(FSCG-FSR2)/RADIUS
      YRTR1=BLR1/RADIUS
      YRTR2=BLR2/RADIUS
      ZRTR1=(WLCG-WLR1)/RADIUS
      ZRTR2=(WLCG-WLR2)/RADIUS
      XWB=(FSCG-FSWB)/RADIUS
      XHT=(FSCG-FSHT)/RADIUS
      XVT=(FSCG-FSVT)/RADIUS
      ZWB=(WLCG-WLWB)/RADIUS
      ZHT=(WLCG-WLHT)/RADIUS
      ZVT=(WLCG-WLVT)/RADIUS
      CST=COS(ASHAFT(1)/CVERT)
      SNT=SIN(ASHAFT(1)/CVERT)
      CSP=COS(ACANT(1)/CVERT)
      SNP=SIN(ACANT(1)/CVERT)
      RSF1(1,1)=-CST
      RSF1(2,1)=-SNP*SNT
      RSF1(3,1)=CSP*SNT
      RSF1(1,2)=0.
      RSF1(2,2)=CSP
      RSF1(3,2)=SNP
      RSF1(1,3)=-SNT
      RSF1(2,3)=SNP*CST
      RSF1(3,3)=-CSP*CST
      CST=COS(ASHAFT(2)/CVERT)
      SNT=SIN(ASHAFT(2)/CVERT)
      CSP=COS(ACANT(2)/CVERT)
      SNP=SIN(ACANT(2)/CVERT)
      IF (ORIENT .EQ. 1) GO TO 21
      RSF2(1,1)=-CST
      RSF2(2,1)=-SNP*SNT
      RSF2(3,1)=CSP*SNT
      RSF2(1,2)=0.
      RSF2(2,2)=CSP
      RSF2(3,2)=SNP
      RSF2(1,3)=-SNT
      RSF2(2,3)=SNP*CST
      RSF2(3,3)=-CSP*CST
      GO TO 22
   21 IF (ROTATE .LT. 0) CSP=-CSP
      RSF2(1,1)=-CST
      RSF2(2,1)=0.
      RSF2(3,1)=SNT
      RSF2(1,2)=CSP*SNT
      RSF2(2,2)=SNP
      RSF2(3,2)=CSP*CST
      RSF2(1,3)=-SNP*SNT
      RSF2(2,3)=CSP
      RSF2(3,3)=-SNP*CST
   22 CONTINUE
      DO 11 I=1,11
      DO 11 K=1,5
   11 TCFE(I,K)=0.
      IF (ORIENT .EQ. 1) GO TO 12
      TCFE(1,1)=KF0CFE
      TCFE(4,1)=KR0CFE
      TCFE(7,1)=KTCFE
      TCFE(8,1)=KFCFE
      TCFE(2,2)=-KFCCFE*COS(PFCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(3,2)= KFCCFE*SIN(PFCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(5,2)= KRCCFE*COS(PRCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(6,2)=-KRCCFE*SIN(PRCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(10,2)=-KACFE
      TCFE(1,3)=-KFSCFE
      TCFE(4,3)=KRSCFE
      TCFE(9,3)=KECFE
      TCFE(2,4)=-KFPCFE*COS(PFPCFE/CVERT)*FLOAT(ROTATE)
      TCFE(3,4)= KFPCFE*SIN(PFPCFE/CVERT)*FLOAT(ROTATE)
      TCFE(5,4)=-KRPCFE*COS(PRPCFE/CVERT)*FLOAT(ROTATE)
      TCFE(6,4)= KRPCFE*SIN(PRPCFE/CVERT)*FLOAT(ROTATE)
      TCFE(11,4)=KRCFE
      TCFE(7,5)=1.
      GO TO 13
   12 TCFE(1,1)=K0CFE
      TCFE(7,1)=KTCFE
      TCFE(8,1)=KFCFE
      TCFE(2,2)=-KCCFE*COS(PCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(3,2)= KCCFE*SIN(PCCFE/CVERT)*FLOAT(ROTATE)
      TCFE(10,2)=-KACFE
      TCFE(2,3)=-KSCFE*SIN(PSCFE/CVERT)
      TCFE(3,3)=-KSCFE*COS(PSCFE/CVERT)
      TCFE(9,3)=KECFE
      TCFE(4,4)=-KPCFE*FLOAT(ROTATE)
      TCFE(11,4)=KRCFE
      TCFE(7,5)=1.
   13 T751=TCFE(1,1)*COLL+TCFE(1,2)*LATCYC+TCFE(1,3)*LNGCYC+TCFE(1,4)*PE-
     1DAL+CNTRLZ(1)
      T1C1=TCFE(2,1)*COLL+TCFE(2,2)*LATCYC+TCFE(2,3)*LNGCYC+TCFE(2,4)*PE-
     1DAL+CNTRLZ(2)
      T1S1=TCFE(3,1)*COLL+TCFE(3,2)*LATCYC+TCFE(3,3)*LNGCYC+TCFE(3,4)*PE-
     1DAL+CNTRLZ(3)
      T752=TCFE(4,1)*COLL+TCFE(4,2)*LATCYC+TCFE(4,3)*LNGCYC+TCFE(4,4)*PE-
     1DAL+CNTRLZ(4)
      T1C2=TCFE(5,1)*COLL+TCFE(5,2)*LATCYC+TCFE(5,3)*LNGCYC+TCFE(5,4)*PE-
     1DAL+CNTRLZ(5)
      T1S2=TCFE(6,1)*COLL+TCFE(6,2)*LATCYC+TCFE(6,3)*LNGCYC+TCFE(6,4)*PE-
     1DAL+CNTRLZ(6)
      RETURN
    2 IF (OPREAD .GE. 2) READ(5,NLFUSE)
      DO 31 I=1,39
   31 AAD(I)=AAH(I)
      AAD(40)=XWB
      AAD(41)=ZWB
      AAD(42)=XHT
      AAD(43)=ZHT
      AAD(44)=XVT
      AAD(45)=ZVT
      AAD(46)=RADIUS
      AAD(47)=GAMMA*DENSE/(SIGMA*5.7)
      AAD(48)=AFLAP
      DO 41 I=1,860
   41 EEDN(I)=0.
      DO 42 I=1,10
      IDENT(I)=0
      IF (I .GT. NEM) GO TO 42
      IDENT(I)=1
      IF (DOFSYM(I+67) .LT. 0) IDENT(I)=-1
   42 CONTINUE
      DO 43 I=1,NEM
      EZN(I)=EZ(I)
      EXN(I)=EX(I)
      ETN(I)=ET(I)*RADIUS
      EZDN(I)=EZD(I)
      EXDN(I)=EXD(I)
      EZLN(I)=EZL(I)/RADIUS
      EXLN(I)=EXL(I)/RADIUS
      ETLN(I)=ETL(I)
      FZHN(I)=FZH(I)
      FXHN(I)=FXH(I)
      FTHN(I)=FTH(I)*RADIUS
      FYWN(I)=FYW(I)
      FFHN(I)=FFH(I)*RADIUS
      FYVN(I)=FYV(I)
      FFVN(I)=FFV(I)*RADIUS
      FPVN(I)=FPV(I)*RADIUS
      DO 43 K=1,NEM
      EZZN(K,I)=EZZ(K,I)
      EXXN(K,I)=EXX(K,I)
      EZXN(K,I)=EZX(K,I)
      EXZN(K,I)=EXZ(K,I)
      EZTN(K,I)=EZT(K,I)*RADIUS
      EXTN(K,I)=EXT(K,I)*RADIUS
   43 ETTN(K,I)=ETT(K,I)*RADIUS**2
      IF (DEBUG .GE. 2) WRITE(6,NLFUSE)
      RETURN
      END
      SUBROUTINE HLBODY
      COMMON /BCOEF/CA(12,16),CB1(3,3),CB2(3,3),A2(16,19),A1(16,19),A0(1-
     16,19),B(16,4),BG(16,3),AA(16,12)
      COMMON /FAERO/CZDZ,CZDX,CZDT,CZDDZ,CXDZ,CXDX,CXDT,CTDZ,CTDX,CTDT,C-
     1TDDZ,CZDQ(8),CZQ(8),CXDQ(8),CXQ(8),CTDQ(8),CTQ(8),CQDZ(8),CQDX(8),-
     2CQDT(8),CQDQ(8,8),CQQ(8,8),CZF,CZE,CZLW,CZLH,CXF,CXE,CXLW,CXLH,CTF-
     3,CTE,CTLW,CTLH,CQF(8),CQE(8),CQLW(8),CQLH(8),CFDF,CFDP,CFDY,CPDF,C-
     4PDP,CPDY,CYDF,CYDP,CYDY,CFDQ(8),CFQ(8),CPDQ(8),CPQ(8),CYDQ(8),CYQ(-
     58),CQDF(8),CQDP(8),CQDY(8),CQDQA(8,8),CQQA(8,8),CFA,CFR,CFLV,CPA,C-
     6PR,CPLV,CYA,CYR,CYLV,CQA(8),CQR(8),CQLV(8),CFDZ,CFDX,CFLW,CPDZ,CPD-
     7X,CPLW,CYDZ,CYDX,CYLW,CQDZA(8),CQDXA(8),CQLWA(8)
      COMMON /R1DATA/HHR1(667)
      EQUIVALENCE (RADIUS,HHR1(14)),(OMEGA,HHR1(13)),(NBLADE,HHR1(2)),(I-
     1B,HHR1(32))
      REAL IB
      COMMON /HINPUT/HHH(506)
      COMMON /GINPUT/HHG(411)
      EQUIVALENCE (THETAF,HHH(399)),(PHIF,HHH(400)),(GRAV,HHH(404)),(VEL-
     1,HHH(21)),(VELX,HHH(401)),(VELY,HHH(402)),(VELZ,HHH(403)),(DEBUG,H-
     2HH(273)),(DOFSYM(1),HHH(151)),(OPAERO,HHH(272))
      EQUIVALENCE (AMASS,HHG(114)),(AIXX,HHG(115)),(AIYY,HHG(116)),(AIZZ-
     1,HHG(117)),(AIXZ,HHG(118)),(XRTR1,HHG(102)),(YRTR1,HHG(103)),(ZRTR-
     21,HHG(104)),(XRTR2,HHG(105)),(YRTR2,HHG(106)),(ZRTR2,HHG(107)),(NE-
     3M,HHG(358)),(QMASS(1),HHG(208)),(QFREQ(1),HHG(218)),(QDAMP(1),HHG(-
     4228)),(ZETAR1(1,1),HHG(238)),(GAMAR1(1,1),HHG(298)),(ZETAR2(1,1),H-
     5HG(268)),(GAMAR2(1,1),HHG(328)),(RSF1(1,1),HHG(359)),(RSF2(1,1),HH-
     6G(368))
      INTEGER DOFSYM(80),OPAERO,DEBUG
      REAL RSF1(3,3),RSF2(3,3),ZETAR1(3,10),GAMAR1(3,10),ZETAR2(3,10),GA-
     1MAR2(3,10),QMASS(10),QFREQ(10),QDAMP(10)
      REAL MSTAR,ROT(3,3),ROT1(3,3),ROT2(3,3)
      DIMENSION ZERO(1426)
      EQUIVALENCE (ZERO(1),CA(1,1))
      DO 10 I=1,1426
   10 ZERO(I)=0.
      SNT=SIN(THETAF)
      CST=COS(THETAF)
      SNP=SIN(PHIF)
      CSP=COS(PHIF)
      CI=.5*FLOAT(NBLADE)*IB
      CM=CI/RADIUS**2
      MSTAR=AMASS/CM
      GM=GRAV/(OMEGA**2*RADIUS)*MSTAR
      A2(1,1)=AIXX/CI
      A2(1,2)=AIXZ*SNP/CI
      A2(1,3)=-(AIXX*SNT+AIXZ*CSP*CST)/CI
      A2(2,1)=A2(1,2)
      A2(2,2)=(AIYY*CSP**2+AIZZ*SNP**2)/CI
      A2(2,3)=((AIYY-AIZZ)*SNP*CSP*CST-AIXZ*SNP*SNT)/CI
      A2(3,1)=A2(1,3)
      A2(3,2)=A2(2,3)
      A2(3,3)=(AIXX*SNT**2+(AIYY*SNP**2+AIZZ*CSP**2)*CST**2+AIXZ*2.*CSP*-
     1SNT*CST)/CI
      A2(4,4)=MSTAR
      A2(5,5)=MSTAR
      A2(6,6)=MSTAR
      A1(4,2)=MSTAR*(VELZ*CSP+VELY*SNP)
      A1(4,3)=MSTAR*(VELZ*SNP-VELY*CSP)*CST
      A1(5,1)=-MSTAR*VELZ
      A1(5,2)=-MSTAR*VELX*SNP
      A1(5,3)=MSTAR*(VELZ*SNT+VELX*CSP*CST)
      A1(6,1)=MSTAR*VELY
      A1(6,2)=-MSTAR*VELX*CSP
      A1(6,3)=-MSTAR*(VELY*SNT+VELX*SNP*CST)
      A0(4,2)= GM*CST
      A0(5,1)=-GM*CST*CSP
      A0(5,2)= GM*SNT*SNP
      A0(6,1)= GM*CST*SNP
      A0(6,2)= GM*SNT*CSP
      DO 21 IE=1,NEM
      QM=QMASS(IE)/CM
      QW=QFREQ(IE)*6.283185/OMEGA
      A2(IE+6,IE+6)=QM
      A1(IE+6,IE+6)=QM*QDAMP(IE)*QW
   21 A0(IE+6,IE+6)=QM*QW*QW
      ROT(1,1)=1.
      ROT(1,2)=0.
      ROT(1,3)=-SNT
      ROT(2,1)=0.
      ROT(2,2)=CSP
      ROT(2,3)=SNP*CST
      ROT(3,1)=0.
      ROT(3,2)=-SNP
      ROT(3,3)=CSP*CST
      ROT1(1,1)=0.
      ROT1(1,2)=ZRTR1*CSP+YRTR1*SNP
      ROT1(1,3)=(ZRTR1*SNP-YRTR1*CSP)*CST
      ROT1(2,1)=-ZRTR1
      ROT1(2,2)=-XRTR1*SNP
      ROT1(2,3)=ZRTR1*SNT+XRTR1*CSP*CST
      ROT1(3,1)=YRTR1
      ROT1(3,2)=-XRTR1*CSP
      ROT1(3,3)=-YRTR1*SNT-XRTR1*SNP*CST
      ROT2(1,1)=0.
      ROT2(1,2)=ZRTR2*CSP+YRTR2*SNP
      ROT2(1,3)=(ZRTR2*SNP-YRTR2*CSP)*CST
      ROT2(2,1)=-ZRTR2
      ROT2(2,2)=-XRTR2*SNP
      ROT2(2,3)=ZRTR2*SNT+XRTR2*CSP*CST
      ROT2(3,1)=YRTR2
      ROT2(3,2)=-XRTR2*CSP
      ROT2(3,3)=-YRTR2*SNT-XRTR2*SNP*CST
      DO 22 I=1,3
      DO 22 K=1,3
      CA(I,K+3)=RSF1(I,K)
      CA(I+6,K+3)=RSF2(I,K)
      DO 22 J=1,3
      CA(I,K)=CA(I,K)+RSF1(I,J)*ROT1(J,K)
      CA(I+6,K)=CA(I+6,K)+RSF2(I,J)*ROT2(J,K)
      CA(I+3,K)=CA(I+3,K)+RSF1(I,J)*ROT(J,K)
   22 CA(I+9,K)=CA(I+9,K)+RSF2(I,J)*ROT(J,K)
      DO 23 IE=1,NEM
      DO 23 I=1,3
      DO 23 J=1,3
      CA(I,IE+6)=CA(I,IE+6)+RSF1(I,J)*ZETAR1(J,IE)
      CA(I+6,IE+6)=CA(I+6,IE+6)+RSF2(I,J)*ZETAR2(J,IE)
      CA(I+3,IE+6)=CA(I+3,IE+6)+RSF1(I,J)*GAMAR1(J,IE)*RADIUS
   23 CA(I+9,IE+6)=CA(I+9,IE+6)+RSF2(I,J)*GAMAR2(J,IE)*RADIUS
      ROT(1,1)=0.
      ROT(1,2)=VELZ*CSP+VELY*SNP
      ROT(1,3)=(VELZ*SNP-VELY*CSP)*CST
      ROT(2,1)=-VELZ
      ROT(2,2)=-VELX*SNP
      ROT(2,3)=VELZ*SNT+VELX*CSP*CST
      ROT(3,1)=VELY
      ROT(3,2)=-VELX*CSP
      ROT(3,3)=-VELY*SNT-VELX*SNP*CST
      DO 24 I=1,3
      DO 24 K=1,3
      DO 24 J=1,3
      CB1(I,K)=CB1(I,K)+RSF1(I,J)*ROT(J,K)
   24 CB2(I,K)=CB2(I,K)+RSF2(I,J)*ROT(J,K)
      DO 25 I=1,16
      AA(I,1)=2.*CA(3,I)
      AA(I,2)=CA(1,I)
      AA(I,3)=-CA(2,I)
      AA(I,4)=-2.*CA(6,I)
      AA(I,5)=CA(5,I)
      AA(I,6)=-CA(4,I)
      AA(I,7)=2.*CA(9,I)
      AA(I,8)=CA(7,I)
      AA(I,9)=-CA(8,I)
      AA(I,10)=-2.*CA(12,I)
      AA(I,11)=CA(11,I)
   25 AA(I,12)=-CA(10,I)
      IF (OPAERO .EQ. 0) GO TO 11
      CALL HLAERO(VEL,VELX,VELY,VELZ,THETAF,PHIF,DEBUG)
      A2(2,6)=-CTDDZ
      A2(6,6)=A2(6,6)-CZDDZ
      A1(1,1)=-CFDF
      A1(1,3)=-CFDP
      A1(1,5)=-CFDY
      A1(1,19)=-CFLV
      A1(3,1)=-CPDF
      A1(3,3)=-CPDP
      A1(3,5)=-CPDY
      A1(3,19)=-CPLV
      A1(5,1)=A1(5,1)-CYDF
      A1(5,3)=A1(5,3)-CYDP
      A1(5,5)=-CYDY
      A1(5,19)=-CYLV
      A1(2,2)=-CTDT
      A1(2,4)=-CTDX
      A1(2,6)=-CTDZ
      A1(2,17)=-CTLW
      A1(2,18)=-CTLH
      A1(4,2)=A1(4,2)-CXDT
      A1(4,4)=-CXDX
      A1(4,6)=-CXDZ
      A1(4,17)=-CXLW
      A1(4,18)=-CXLH
      A1(6,2)=A1(6,2)-CZDT
      A1(6,4)=-CZDX
      A1(6,6)=-CZDZ
      A1(6,17)=-CZLW
      A1(6,18)=-CZLH
      B(1,3)=CFA
      B(1,4)=CFR
      B(3,3)=CPA
      B(3,4)=CPR
      B(5,3)=CYA
      B(5,4)=CYR
      B(2,1)=CTF
      B(2,2)=CTE
      B(4,1)=CXF
      B(4,2)=CXE
      B(6,1)=CZF
      B(6,2)=CZE
      BG(1,2)=CFDY
      BG(3,2)=CPDY
      BG(5,2)=CYDY
      BG(2,1)=CTDX
      BG(2,3)=CTDZ
      BG(4,1)=CXDX
      BG(4,3)=CXDZ
      BG(6,1)=CZDX
      BG(6,3)=CZDZ
      IS=0
      IA=0
      DO 31 IE=1,NEM
      IF (DOFSYM(IE+67) .LT. 0) GO TO 32
      IS=IS+1
      A1(2,IE+6)=-CTDQ(IS)
      A1(4,IE+6)=-CXDQ(IS)
      A1(6,IE+6)=-CZDQ(IS)
      A1(IE+6,2)=-CQDT(IS)
      A1(IE+6,4)=-CQDX(IS)
      A1(IE+6,6)=-CQDZ(IS)
      A1(IE+6,17)=-CQLW(IS)
      A1(IE+6,18)=-CQLH(IS)
      A0(2,IE+6)=-CTQ(IS)
      A0(4,IE+6)=-CXQ(IS)
      A0(6,IE+6)=-CZQ(IS)
      B(IE+6,1)=CQF(IS)
      B(IE+6,2)=CQE(IS)
      BG(IE+6,1)=CQDX(IS)
      BG(IE+6,3)=CQDZ(IS)
      JS=0
      DO 33 JE=1,NEM
      IF (DOFSYM(JE+67) .LT. 0) GO TO 33
      JS=JS+1
      A1(IE+6,JE+6)=A1(IE+6,JE+6)-CQDQ(IS,JS)
      A0(IE+6,JE+6)=A0(IE+6,JE+6)-CQQ(IS,JS)
   33 CONTINUE
      GO TO 31
   32 IA=IA+1
      A1(1,IE+6)=-CFDQ(IA)
      A1(3,IE+6)=-CPDQ(IA)
      A1(5,IE+6)=-CYDQ(IA)
      A1(IE+6,1)=-CQDF(IA)
      A1(IE+6,3)=-CQDP(IA)
      A1(IE+6,5)=-CQDY(IA)
      A1(IE+6,19)=-CQLV(IA)
      A0(1,IE+6)=-CFQ(IA)
      A0(3,IE+6)=-CPQ(IA)
      A0(5,IE+6)=-CYQ(IA)
      B(IE+6,3)=CQA(IA)
      B(IE+6,4)=CQR(IA)
      BG(IE+6,2)=CQDY(IA)
      JA=0
      DO 34 JE=1,NEM
      IF (DOFSYM(JE+67) .GT. 0) GO TO 34
      JA=JA+1
      A1(IE+6,JE+6)=A1(IE+6,JE+6)-CQDQA(IA,JA)
      A0(IE+6,JE+6)=A0(IE+6,JE+6)-CQQA(IA,JA)
   34 CONTINUE
   31 CONTINUE
   11 CONTINUE
      RETURN
      END
      SUBROUTINE HLTRIM
      COMMON /HINPUT/TITLE(18),VTIP,RPM,VEL,VKTS,OPUNIT,ALTMSL,TEMP,ALTA-
     1GL,ACLIMB,AYAW,APITCH,AROLL,COLL,LNGCYC,LATCYC,PEDAL,WEIGHT,AFLAP,-
     2ITER,EPTRIM,FACTOR,PTRIM,DOF(80),CON(26),GUST(3),OPSYMM,DOFSYM(80)-
     3,CONSYM(26),GUSSYM(3),OPFLOW,OPTORS(2),OPMOTR,OPLMDA(2),OPINTR,OPQ-
     4RTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,TONLY,MPER,JCNST,NSYS-
     5AN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP(80),CONP(29),CNTRL0,CNT-
     6RLC,CNTRLS,CNTRLP,THETFP,PSIFP,THETAF,PHIF,VELX,VELY,VELZ,GRAV,DEN-
     7SE,CSOUND,FREQ(100)
      COMMON /GINPUT/ORIENT,ASHAFT(2),ACANT(2),K12H,K12F,K12L,K21H,K21F,-
     1K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR-
     22,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,TAUH,TAUV,RTRANS,IENG,KMAST1,KM-
     3AST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,TH-
     4RTLC,NRPOWR,EDAMPC,KPMC1(10),KPMS1(10),KPMC2(10),KPMS2(10),FSR1,WL-
     5R1,BLR1,FSR2,WLR2,BLR2,FSCG,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX-
     6,IYY,IZZ,IXZ,XRTR1,YRTR1,ZRTR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,X-
     7VT,ZVT,AMASS,AIXX,AIYY,AIZZ,AIXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCF-
     8E,PRCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCC-
     9FE,PSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ(11),TCFE-
     A(11,5),QMASS(10),QFREQ(10),QDAMP(10),ZETAR1(3,10),ZETAR2(3,10),GAM-
     BAR1(3,10),GAMAR2(3,10),NEM,RSF1(3,3),RSF2(3,3),RFV(3,3),RSV1(3,3),-
     CRSV2(3,3),ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,EDAMP,QTHRTL
      INTEGER OPUNIT,ORIENT,DOF,CON,GUST,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPF-
     1LOW,OPTORS,OPMOTR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND-
     2,OPAERO,DEBUG,TONLY,RESPON,DOFP,CONP,ENGPOS
      REAL LNGCYC,LATCYC,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWR-
     1TR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,IENG,KMAST1,KMAST2,KICS,KENG,KPR1G-
     2V,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,NRPOWR,KPMC1,KPMC2,KPMS1,KPMS-
     32,IXX,IYY,IZZ,IXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,KF0CFE,KR0CFE,KFSCFE-
     4,KRSCFE,KCCFE,KSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,LMDA-
     501,LMDA02
      COMMON /R1DATA/HHR1(667)
      EQUIVALENCE (THETA1(1),HHR1(294)),(T1C1,HHR1(21)),(T1S1,HHR1(22)),-
     1(TWIST1(1),HHR1(396)),(LAMDA1,HHR1(7)),(MU1,HHR1(6)),(MUY1,HHR1(88-
     2)),(MUZ1,HHR1(89)),(ALFHP1,HHR1(657)),(PSIHP1,HHR1(658)),(KFLMD1,H-
     3HR1(656)),(KHLMD1,HHR1(655)),(VTOT1,HHR1(654)),(IRING1,HHR1(662)),-
     4(SIGMA1,HHR1(15)),(GAMMA1,HHR1(12)),(ROTAT1,HHR1(663)),(RADUS1,HHR-
     51(14)),(IB1,HHR1(32)),(NBLAD1,HHR1(2)),(OMEGA1,HHR1(13))
      INTEGER ROTAT1
      REAL MU1,MUY1,MUZ1,LAMDA1,THETA1(51),TWIST1(51),KHLMD1,KFLMD1,IB1
      COMMON /R2DATA/HHR2(667)
      EQUIVALENCE (THETA2(1),HHR2(294)),(T1C2,HHR2(21)),(T1S2,HHR2(22)),-
     1(TWIST2(1),HHR2(396)),(LAMDA2,HHR2(7)),(MU2,HHR2(6)),(MUY2,HHR2(88-
     2)),(MUZ2,HHR2(89)),(ALFHP2,HHR2(657)),(PSIHP2,HHR2(658)),(KFLMD2,H-
     3HR2(656)),(KHLMD2,HHR2(655)),(VTOT2,HHR2(654)),(IRING2,HHR2(662)),-
     4(SIGMA2,HHR2(15)),(GAMMA2,HHR2(12)),(ROTAT2,HHR2(663)),(RADUS2,HHR-
     52(14)),(IB2,HHR2(32)),(NBLAD2,HHR2(2)),(OMEGA2,HHR2(13))
      INTEGER ROTAT2
      REAL MU2,MUY2,MUZ2,LAMDA2,THETA2(51),TWIST2(51),KHLMD2,KFLMD2,IB2
      COMMON /FADATA/LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,DRG-
     10W,DRGDW,DRGFW,DRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB,S-
     2PANW,AREAW,CHORDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,LF-
     3TEH,AMAXH,IHT,SPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,HHFA(9)
      REAL LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,KCLB,IWB,LFLA-
     1PO,LFLAPI,LAILO,LAILI,LFTAH,LFTEH,IHT,LFTAV,LFTEV,IVT
      COMMON /XTRIM/LW,DW,MYW,YW,MXW,MZW,LH,DH,LV,DV,LAW,LFW,LEW,DAW,DFW-
     1,DEW,MAW,MFW,NXBW,NZBW,YBW,LAH,LEH,DAH,DEH,LAV,LEV,DAV,DEV
      REAL LW,MYW,MXW,MZW,LH,LV,LAW,LFW,LEW,MAW,MFW,NXBW,NZBW,LAH,LEH,LA-
     1V,LEV
      COMMON  /ZTRIM/HHT1(27),CT1,CH1,CY1,CMX1,CMY1,CQ1,HHT3(2342)
      COMMON /ZTRIM2/HHT2(27),CT2,CH2,CY2,CMX2,CMY2,CQ2,HHT4(2342)
      REAL ZERO1(33),ZERO2(33)
      EQUIVALENCE (HHT1(1),ZERO1(1)),(HHT2(1),ZERO2(1))
      REAL MOMX,MOMY,MOMZ,FORCE(7)
      EQUIVALENCE (FORX,FORCE(1)),(FORY,FORCE(2)),(FORZ,FORCE(3)),(MOMX,-
     1FORCE(4)),(MOMY,FORCE(5)),(MOMZ,FORCE(6)),(POWR,FORCE(7))
      INTEGER LMINV(8),MMINV(8)
      REAL DERIV(7,7),KE(3),FR1(3),FR2(3),XF(3),ZF(3),LWAKE,CPOWR(2)
      DATA CPOWR/550.,746./
      DATA CVERT/57.29578/
  999 FORMAT (1H1,'PERFORMANCE AND TRIM'/)
  997 FORMAT (//5X,'NO FORCE TRIM')
  996 FORMAT (//5X,'NO TRIM')
  995 FORMAT (//5X,'FORCE TRIM ITERATIONS =',I4,7X,'(MAXIMUM =',I4,',  T-
     1OLERANCE =',F7.4,')')
  994 FORMAT (5X,'WEIGHT  CW/S =',F10.6,10X,'TARGET POWER  CP/S =',F10.6-
     1)
  993 FORMAT (5X,'WEIGHT  CW/S =',F10.6)
  992 FORMAT (/ 5X,'AIRCRAFT FORCES'/10X,'CFZ/S =',F10.6,10X,'WB LIFT ='-
     1,F10.0, 5X,'HT LIFT =',F10.0, 5X,'VT LIFT =',F10.0/10X,'CFX/S =',F-
     210.6,10X,'WB DRAG =',F10.0, 5X,'HT DRAG =',F10.0, 5X,'VT DRAG =',F-
     310.0/10X,'CMY/S =',F10.6,10X,'WB MOMY =',F10.0//10X,'CFY/S =',F10.-
     46,10X,'WB SIDE =',F10.0/10X,'CMX/S =',F10.6,10X,'WB MOMX =',F10.0/-
     510X,'CMZ/S =',F10.6,10X,'WB MOMZ =',F10.0//10X,'CP/S  =',F10.6)
  998 FORMAT (5X,'VEL =',F8.4,11X,'ALPHA =',F8.2, 8X,'COLL. STICK  =',F8-
     1.2, 7X,'(INPUT COLL   =',F8.2,')'/5X,'VELX =',F8.4,10X,'BETA  =',F-
     28.2, 8X,'LONG. CYCLIC =',F8.2, 7X,'(INPUT LNGCYC =',F8.2,')'/5X,'V-
     3ELY =',F8.4,10X,'ALPHA-HT =',F8.2, 5X,'LAT. CYCLIC  =',F8.2, 7X,'(-
     4INPUT LATCYC =',F8.2,')'/5X,'VELZ =',F8.4,10X,'ALPHA-VT =',F8.2, 5-
     5X,'PEDAL        =',F8.2,7X,'(INPUT PEDAL  =',F8.2,')'//5X,'VELC ='-
     6,F8.4,10X,'DEL-F =',F8.2, 8X,'THETA-F  =',F8.2,11X,'(INPUT APITCH -
     7=',F8.2,')'/5X,'VELS =',F8.4,10X,'DEL-E =',F8.2, 8X,'PHI-F    =',F-
     88.2,11X,'(INPUT AROLL  =',F8.2,')'/5X,'VCLIMB =',F8.2,8X,'DEL-A ='-
     9,F8.2, 8X,'THETA-FP =',F8.2,11X,'(INPUT ACLIMB =',F8.2,')'/5X,'VSI-
     ADE =',F9.2,8X,'DEL-R =',F8.2, 8X,'PSI-FP   =',F8.2,11X,'(INPUT AYA-
     BW   =',F8.2,')'/5X,'PCLIMB =',F9.2,30X,'AFLAP =',F8.2/5X,'POWER (H-
     CP) =',F9.2)
  989 FORMAT (1X,I2,3X,7F7.3,3X,7F9.5)
  988 FORMAT (1H1/9X,'C0',5X,'CS',5X,'CC',5X,'CP',5X,'TF',5X,'PF',4X,'TF-
     1P',10X,'FX',7X,'FY',7X,'FZ',7X,'MX',7X,'MY',7X,'MZ',8X,'P'/)
      DO 10 J=1,33
      ZERO1(J)=0.
   10 ZERO2(J)=0.
      IF (TONLY .EQ. 0) PRINT 988
      V2=VEL*VEL*.5/(SIGMA1*3.141593*RADUS1**2)
      GM=AMASS*GRAV/(FLOAT(NBLAD1)*IB1*OMEGA1**2/RADUS1)*5.7/(GAMMA1*DEN-
     1SE)
      DELF=TCFE(8,1)*CNTRL0+TCFE(8,2)*CNTRLC+TCFE(8,3)*CNTRLS+TCFE(8,4)*-
     1CNTRLP+CNTRLZ(8)/CVERT
      ALPHA=APITCH-ACLIMB+IWB
      IF (ABS(ALPHA) .GT. AMAXW) ALPHA=SIGN(AMAXW,ALPHA)
      LW=(LFTAW*ALPHA+LFTDW*AFLAP)/CVERT+LFTFW*(LFLAPO-LFLAPI)*DELF
      CTLMD1=GM*SIGMA1-LW*.1591549*(VEL/RADUS1)**2
      IF (ORIENT .EQ. 2) CTLMD1=.5*CTLMD1
      CTLMD2=0.
      IF (ORIENT .EQ. 2) CTLMD2=CTLMD1*(OMEGA1**2*RADUS1**4)/(OMEGA2**2*-
     1RADUS2**4)
      CTOS1=1.0526*CTLMD1/SIGMA1
      CTOS2=1.0526*CTLMD2/SIGMA2
      OR21=(OMEGA2*RADUS2)/(OMEGA1*RADUS1)
      CNSTM=(FLOAT(NBLAD2)*IB2*OMEGA2**2)/(FLOAT(NBLAD1)*IB1*OMEGA1**2) -
     1*GAMMA2/GAMMA1
      CNSTP=CNSTM*OMEGA2/OMEGA1
      CNSTF=CNSTM*RADUS1/RADUS2
      MDERIV=6
      IF (OPTRIM .EQ. 2) MDERIV=7
      ITERM=ITER+(1+(ITER-1)/10)*MDERIV+1
      ITERD=MDERIV+10
      ITERC=0
    5 ITERC=ITERC+1
      ITERCR=MOD(ITERC-1,ITERD)+1
      CSTF=COS(THETAF)
      SNTF=SIN(THETAF)
      CSTFP=COS(THETFP)
      SNTFP=SIN(THETFP)
      CSPF=COS(PHIF)
      CSPF=COS(PHIF)
      SNPF=SIN(PHIF)
      CSPFP=COS(PSIFP)
      SNPFP=SIN(PSIFP)
      RFV(1,1)=CSTF*CSTFP*CSPFP+SNTF*SNTFP
      RFV(2,1)=SNTF*SNPF*CSTFP*CSPFP+CSPF*CSTFP*SNPFP-CSTF*SNPF*SNTFP
      RFV(3,1)=SNTF*CSPF*CSTFP*CSPFP-SNPF*CSTFP*SNPFP-CSTF*CSPF*SNTFP
      RFV(1,2)=-CSTF*SNPFP
      RFV(2,2)=-SNTF*SNPF*SNPFP+CSPF*CSPFP
      RFV(3,2)=-SNTF*CSPF*SNPFP-SNPF*CSPFP
      RFV(1,3)=CSTF*SNTFP*CSPFP-SNTF*CSTFP
      RFV(2,3)=SNTF*SNPF*SNTFP*CSPFP+CSPF*SNTFP*SNPFP+CSTF*SNPF*CSTFP
      RFV(3,3)=SNTF*CSPF*SNTFP*CSPFP-SNPF*SNTFP*SNPFP+CSTF*CSPF*CSTFP
      ONE=1.
      DO 21 I=1,3
      ONE=-ONE
      DO 21 K=1,3
      RSV1(I,K)=0.
      RSV2(I,K)=0.
      DO 21 J=1,3
      RSV1(I,K)=RSV1(I,K)+ONE*RSF1(I,J)*RFV(J,K)
   21 RSV2(I,K)=RSV2(I,K)+ONE*RSF2(I,J)*RFV(J,K)
      VELX=VEL*RFV(1,1)
      VELY=VEL*RFV(2,1)
      VELZ=VEL*RFV(3,1)
      CSII=-RSV1(1,1)
      CSJI= RSV1(2,1)
      CSKI=-RSV1(3,1)
      VTOT1=0.
      MU1=0.
      MUY1=0.
      IF (OPFLOW .EQ. 0) GO TO 23
      MU1=-VEL*CSII
      MUY1= VEL*CSJI*FLOAT(ROTAT1)
      VTOT1=MU1*MU1+MUY1*MUY1
      IF (VTOT1 .GT. 0.) VTOT1=SQRT(VTOT1)
   23 MUZ1= VEL*CSKI
      PSIHP1=0.
      ALFHP1=0.
      IF ((CSJI.NE.0.).OR.(CSII.NE.0.)) PSIHP1=ATAN2(CSJI,-CSII)*CVERT
      CSII=CSII**2+CSJI**2
      IF (CSII .GT. 0.) CSII=SQRT(CSII)
      IF ((CSKI.NE.0.).OR.(CSII.NE.0.)) ALFHP1=ATAN2( CSKI,CSII)*CVERT
      IF ((ITERCR.GT.MDERIV+2) .OR. ((ITERCR.LE.1).AND.(ITERC.GT.2))) CT-
     1LMD1=CT1*SIGMA1
      U2=(MU1*MU1+MUY1*MUY1)/KFLMD1**2
      X1=.5*CTLMD1
      X2=KHLMD1**4
      LMDA01=MUZ1+X1/SQRT(ABS(X1/KHLMD1**2+VEL*VEL))
      DO 24 I=1,4
      X3=(SQRT(LMDA01*LMDA01/X2+U2))**3
   24 LMDA01=(X3*MUZ1+X1*(2.*LMDA01*LMDA01/X2+U2))/(X3+X1*LMDA01/X2)
      IRING1=0
      IF (X1 .NE. 0.) X1=SQRT(ABS(X1))
      IF (MU1*MU1+MUY1*MUY1+(2.*MUZ1+3.*X1)**2 .GT. X1*X1) GO TO 25
      IRING1=1
      LMDA01=MUZ1*((.373*MUZ1*MUZ1+.598*(MU1*MU1+MUY1*MUY1))/(X1*X1)-1.9-
     191)*KHLMD1+MUZ1
   25 IF (VTOT1 .EQ. 0.) VTOT1=.0001
      CSII=-RSV2(1,1)
      CSJI= RSV2(2,1)
      CSKI=-RSV2(3,1)
      VTOT2=0.
      MU2=0.
      MUY2=0.
      IF (OPFLOW .EQ. 0) GO TO 27
      MU2=-VEL*CSII/OR21
      MUY2= VEL*CSJI*FLOAT(ROTAT2)/OR21
      VTOT2=MU2*MU2+MUY2*MUY2
      IF (VTOT2 .GT. 0.) VTOT2=SQRT(VTOT2)
   27 MUZ2= VEL*CSKI/OR21
      PSIHP2=0.
      ALFHP2=0.
      IF ((CSJI.NE.0.).OR.(CSII.NE.0.)) PSIHP2=ATAN2(CSJI,-CSII)*CVERT
      CSII=CSII**2+CSJI**2
      IF (CSII .GT. 0.) CSII=SQRT(CSII)
      IF ((CSKI.NE.0.).OR.(CSII.NE.0.)) ALFHP2=ATAN2( CSKI,CSII)*CVERT
      IF ((ORIENT .EQ. 2) .OR. (ITERC .GT. 1)) GO TO 128
      CTLMD2=(CTLMD1*LMDA01+SIGMA1*.001*(1.+4.6*VTOT1**2))/(ABS(XRTR1-XR-
     1TR2))*(OMEGA1**2*RADUS1**4)/(OMEGA2**2*RADUS2**4)
      CTOS2=1.0526*CTLMD2/SIGMA2
  128 IF ((ITERCR.LE.MDERIV+2) .AND. ((ITERCR.GT.1).OR.(ITERC.LE.2))) GO-
     1 TO 129
      IF (ORIENT .EQ. 1) CTLMD2=(2.*CTLMD2+CT2*SIGMA2)/3.
      IF (ORIENT .EQ. 2) CTLMD2=CT2*SIGMA2
  129 CONTINUE
      U2=(MU2*MU2+MUY2*MUY2)/KFLMD2**2
      X1=.5*CTLMD2
      X2=KHLMD2**4
      LMDA02=MUZ2+X1/SQRT(ABS(X1/KHLMD2**2+(VEL/OR21)**2))
      DO 28 I=1,4
      X3=(SQRT(LMDA02*LMDA02/X2+U2))**3
   28 LMDA02=(X3*MUZ2+X1*(2.*LMDA02*LMDA02/X2+U2))/(X3+X1*LMDA02/X2)
      IRING2=0
      IF (X1 .NE. 0.) X1=SQRT(ABS(X1))
      IF (MU2*MU2+MUY2*MUY2+(2.*MUZ2+3.*X1)**2 .GT. X1*X1) GO TO 29
      IRING2=1
      LMDA02=MUZ2*((.373*MUZ2*MUZ2+.598*(MU2*MU2+MUY2*MUY2))/(X1*X1)-1.9-
     191)*KHLMD2+MUZ2
   29 IF (VTOT2 .EQ. 0.) VTOT2=.0001
      KE(1)=-SNTF
      KE(2)=CSTF*SNPF
      KE(3)=CSTF*CSPF
      IF (OPGRND .EQ. 0) GO TO 30
      ZAGL1=ALTAGL/RADUS1-XRTR1*KE(1)-YRTR1*KE(2)-ZRTR1*KE(3)
      ZAGL2=(ALTAGL-(XRTR2*KE(1)+YRTR2*KE(2)+ZRTR2*KE(3))*RADUS1)/RADUS2
      CSEGE1=0.
      CSEGE2=0.
      DO 31 I=1,3
      CSEGE1=CSEGE1+(MU1*RSF1(1,I)-MUY1*RSF1(2,I)-LMDA01*RSF1(3,I))*KE(I-
     1)
   31 CSEGE2=CSEGE2+(MU2*RSF2(1,I)-MUY2*RSF2(2,I)-LMDA02*RSF2(3,I))*KE(I-
     1)
      U2=MU1*MU1+MUY1*MUY1+LMDA01*LMDA01
      IF (U2 .GT. 0.) U2=1./SQRT(U2)
      CSEGE1=CSEGE1*U2
      U2=MU2*MU2+MUY2*MUY2+LMDA02*LMDA02
      IF (U2 .GT. 0.) U2=1./SQRT(U2)
      CSEGE2=CSEGE2*U2
      LMDA01=MUZ1+(1.-(CSEGE1*.25/ZAGL1)**2)*(LMDA01-MUZ1)
      LMDA02=MUZ2+(1.-(CSEGE2*.25/ZAGL2)**2)*(LMDA02-MUZ2)
   30 K12L=AMIN1(AMAX1(K12H,K12F),AMAX1(AMIN1(K12H,K12F),(2.-20.*VTOT1)*-
     1K12H+(20.*VTOT1-1.)*K12F))
      K21L=AMIN1(AMAX1(K21H,K21F),AMAX1(AMIN1(K21H,K21F),(2.-20.*VTOT2)*-
     1K21H+(20.*VTOT2-1.)*K21F))
      LAMDA1=LMDA01+K12L*OR21*(LMDA02-MUZ2)
      LAMDA2=LMDA02+K21L/OR21*(LMDA01-MUZ1)
      CWRTR1=KWRTR1
      CHRTR1=KHRTR1
      CVRTR1=0.
      FH1=LAMDA1*RSF1(1,1)+MU1*RSF1(3,1)
      FH3=LAMDA1*RSF1(1,3)+MU1*RSF1(3,3)
      LWAKE=ABS(FH1*(XRTR1-XWB)+FH3*(ZRTR1-ZWB))-LAMDA1
      IF (LWAKE .GT. 0.) CWRTR1=CWRTR1*MU1/(MU1+LWAKE)
      LWAKE=ABS(FH1*(XRTR1-XHT)+FH3*(ZRTR1-ZHT))-LAMDA1
      IF (LWAKE .GT. 0.) CHRTR1=CHRTR1*MU1/(MU1+LWAKE)
      IF (ORIENT .EQ. 1) GO TO 131
      CWRTR2=KWRTR2*OR21
      CHRTR2=KHRTR2*OR21
      CVRTR2=0.
      FH1=LAMDA2*RSF2(1,1)+MU2*RSF2(3,1)
      FH3=LAMDA2*RSF2(1,3)+MU2*RSF2(3,3)
      LWAKE=ABS(FH1*(XRTR2-XWB)+FH3*(ZRTR2-ZWB))-LAMDA2
      IF (LWAKE .GT. 0.) CWRTR2=CWRTR2*MU2/(MU2+LWAKE)
      LWAKE=ABS(FH1*(XRTR2-XHT)+FH3*(ZRTR2-ZHT))-LAMDA2
      IF (LWAKE .GT. 0.) CHRTR2=CHRTR2*MU2/(MU2+LWAKE)
      GO TO 132
  131 CWRTR2=0.
      CHRTR2=0.
      CVRTR2=KVRTR2*OR21
      LWAKE=ABS((LAMDA2*RSF2(1,1)+MU2*RSF2(3,1))*(XRTR2-XVT)+(LAMDA2*RSF-
     12(1,2)+MU2*RSF2(3,2))*YRTR2)-LAMDA2
      IF (LWAKE .GT. 0.) CVRTR2=CVRTR2*MU2/(MU2+LWAKE)
  132 CONTINUE
      ALPHA=0.
      UL1=LAMDA1-MUZ1
      UL2=LAMDA2-MUZ2
      U2=VELX**2+VELZ**2
      IF (U2 .GT. 0.) U2=SQRT(U2)
      X1=VEL*VELZ+U2*(UL1*CWRTR1*RSF1(3,3)+UL2*CWRTR2*RSF2(3,3))*KLTRIM
      X2=VEL*VELX+U2*(UL1*CWRTR1*RSF1(3,1)+UL2*CWRTR2*RSF2(3,1))*KLTRIM
      IF ((X1.NE.0.).OR.(X2.NE.0.)) ALPHA=ATAN2(X1,X2)
      BETA=0.
      IF ((VELX.NE.0.).OR.(VELY.NE.0.)) BETA=ATAN2(VELY,VELX)
      ALFHT=0.
      DAHT=0.
      IF (AREAW .NE. 0.) DAHT=LW/AREAW*.45/((SPANW**2/AREAW)**.735*(ABS(-
     1XHT*RADUS1/CHORDW))**.25)*KLTRIM
      X1=VEL*(VELZ-DAHT*VELX)+U2*(   UL1*CHRTR1*RSF1(3,3)+   UL2*CHRTR2*-
     1RSF2(3,3))*KLTRIM
      X2=VEL*(VELX+DAHT*VELZ)+U2*(   UL1*CHRTR1*RSF1(3,1)+   UL2*CHRTR2*-
     1RSF2(3,1))*KLTRIM
      IF ((X1.NE.0.).OR.(X2.NE.0.)) ALFHT=ATAN2(X1,X2)
      ALFVT=0.
      U2=VELX**2+VELY**2
      IF (U2 .GT. 0.) U2=SQRT(U2)
      X1=VEL*VELY+U2*(UL1*CVRTR1*RSF1(3,2)+UL2*CVRTR2*RSF2(3,2))*KLTRIM
      X2=VEL*VELX+U2*(UL1*CVRTR1*RSF1(3,1)+UL2*CVRTR2*RSF2(3,1))*KLTRIM
      IF ((X1.NE.0.).OR.(X2.NE.0.)) ALFVT=ATAN2(X1,X2)
      T751=TCFE(1,1)*CNTRL0+TCFE(1,2)*CNTRLC+TCFE(1,3)*CNTRLS+TCFE(1,4)*-
     1CNTRLP+CNTRLZ(1)/CVERT
      T1C1=TCFE(2,1)*CNTRL0+TCFE(2,2)*CNTRLC+TCFE(2,3)*CNTRLS+TCFE(2,4)*-
     1CNTRLP+CNTRLZ(2)/CVERT
      T1S1=TCFE(3,1)*CNTRL0+TCFE(3,2)*CNTRLC+TCFE(3,3)*CNTRLS+TCFE(3,4)*-
     1CNTRLP+CNTRLZ(3)/CVERT
      T752=TCFE(4,1)*CNTRL0+TCFE(4,2)*CNTRLC+TCFE(4,3)*CNTRLS+TCFE(4,4)*-
     1CNTRLP+CNTRLZ(4)/CVERT
      T1C2=TCFE(5,1)*CNTRL0+TCFE(5,2)*CNTRLC+TCFE(5,3)*CNTRLS+TCFE(5,4)*-
     1CNTRLP+CNTRLZ(5)/CVERT
      T1S2=TCFE(6,1)*CNTRL0+TCFE(6,2)*CNTRLC+TCFE(6,3)*CNTRLS+TCFE(6,4)*-
     1CNTRLP+CNTRLZ(6)/CVERT
      DELF=TCFE(8,1)*CNTRL0+TCFE(8,2)*CNTRLC+TCFE(8,3)*CNTRLS+TCFE(8,4)*-
     1CNTRLP+CNTRLZ(8)/CVERT
      DELE=TCFE(9,1)*CNTRL0+TCFE(9,2)*CNTRLC+TCFE(9,3)*CNTRLS+TCFE(9,4)*-
     1CNTRLP+CNTRLZ(9)/CVERT
      DELA=TCFE(10,1)*CNTRL0+TCFE(10,2)*CNTRLC+TCFE(10,3)*CNTRLS+TCFE(10-
     1,4)*CNTRLP+CNTRLZ(10)/CVERT
      DELR=TCFE(11,1)*CNTRL0+TCFE(11,2)*CNTRLC+TCFE(11,3)*CNTRLS+TCFE(11-
     1,4)*CNTRLP+CNTRLZ(11)/CVERT
      DO 32 JR=1,51
      THETA1(JR)=T751+TWIST1(JR)/CVERT
   32 THETA2(JR)=T752+TWIST2(JR)/CVERT
      CALL JUGGLE(7)
      CALL RTRIM(ITERC,CTOS2)
      CALL JUGGLE(6)
      CALL RTRIM(ITERC,CTOS1)
      CALL ACHAR(ALPHA,BETA,DELF,DELA,ALFHT,DELE,ALFVT,DELR)
      DO 33 I=1,3
      FR1(I)=RSF1(1,I)*CH1+RSF1(2,I)*CY1+RSF1(3,I)*CT1
      FR2(I)=CNSTF*(RSF2(1,I)*CH2+RSF2(2,I)*CY2+RSF2(3,I)*CT2)
      FORCE(I)=GM*KE(I)+FR1(I)+FR2(I)+V2*(-RFV(I,1)*(DW+DH+DV)+RFV(I,2)*-
     1(YW-LV)-RFV(I,3)*(LW+LH))
   33 FORCE(I+3)=RSF1(1,I)*CMX1+RSF1(2,I)*CMY1-RSF1(3,I)*CQ1+CNSTM*(RSF2-
     1(1,I)*CMX1+RSF2(2,I)*CMY2-RSF2(3,I)*CQ2)+V2/RADUS1*(RFV(I,1)*MXW+R-
     2FV(I,2)*MYW+RFV(I,3)*MZW)
      ZF(1)=ZWB*DW+ZHT*DH+ZVT*DV
      ZF(2)=-ZWB*YW+ZVT*LV
      ZF(3)=ZWB*LW+ZHT*LH
      XF(1)=XWB*DW+XHT*DH+XVT*DH
      XF(2)=-XWB*YW+XVT*LV
      XF(3)=XWB*LW+XHT*LH
      DO 34 I=1,3
      MOMX=MOMX+V2*ZF(I)*RFV(2,I)
      MOMY=MOMY-V2*ZF(I)*RFV(1,I)+V2*XF(I)*RFV(3,I)
   34 MOMZ=MOMZ-V2*XF(I)*RFV(2,I)
      MOMX=MOMX-ZRTR1*FR1(2)+YRTR1*FR1(3)-ZRTR2*FR2(2)+YRTR2*FR2(3)
      MOMY=MOMY+ZRTR1*FR1(1)-XRTR1*FR1(3)+ZRTR2*FR2(1)-XRTR2*FR2(3)
      MOMZ=MOMZ-YRTR1*FR1(1)+XRTR1*FR1(2)-YRTR2*FR2(1)+XRTR2*FR2(2)
      POWR=0.
      IF (OPTRIM .EQ. 2) POWR=CQ1*FLOAT(ROTAT1)+CNSTP*CQ2*FLOAT(ROTAT2)--
     1PTRIM
      IF (TONLY .EQ. 0) PRINT 989, ITERCR,CNTRL0,CNTRLS,CNTRLC,CNTRLP,TH-
     1ETAF,PHIF,THETFP,(FORCE(I), I=1,7)
      IF ((OPTRIM.LE.0).OR.(ITERC.GE.ITERM)) GO TO 6
      IF (((ITERCR.LE.MDERIV+2).AND.(ITERCR.GE.2)) .OR. (ITERC.EQ.1))   -
     1GO TO 149
      IF (ITERC .EQ. MDERIV+3) GO TO 149
      IF ((FORX**2+FORY**2+FORZ**2 .LE. (EPTRIM*GM)**2) .AND. (MOMX**2+M-
     1OMY**2+MOMZ**2 .LE..0025*(EPTRIM*GM)**2) .AND. (ABS(POWR) .LE. AMA-
     2X1(ABS(LAMDA1*GM),.001)*EPTRIM)) GO TO 6
  149 GO TO (141,142,143,144,145,146,147,148),ITERCR
  140 DO 40 I=1,MDERIV
      CNTRL0=CNTRL0-DERIV(1,I)*FORCE(I)
      CNTRLC=CNTRLC-DERIV(2,I)*FORCE(I)
      CNTRLS=CNTRLS-DERIV(3,I)*FORCE(I)
      CNTRLP=CNTRLP-DERIV(4,I)*FORCE(I)
      THETAF=THETAF-DERIV(5,I)*FORCE(I)
      PHIF=PHIF-DERIV(6,I)*FORCE(I)
      IF (OPTRIM .EQ. 2) THETFP=THETFP-DERIV(7,I)*FORCE(I)
   40 CONTINUE
      GO TO 5
  141 DO 41 I=1,MDERIV
      DO 41 J=1,MDERIV
   41 DERIV(J,I)=FORCE(J)
      CNTRL0=CNTRL0-.01*FACTOR
      GO TO 5
  142 DO 42 J=1,MDERIV
   42 DERIV(J,1)=DERIV(J,1)-FORCE(J)
      CNTRL0=CNTRL0+.01*FACTOR
      CNTRLC=CNTRLC-.02
      GO TO 5
  143 DO 43 J=1,MDERIV
   43 DERIV(J,2)=DERIV(J,2)-FORCE(J)
      CNTRLC=CNTRLC+.02
      CNTRLS=CNTRLS-.02
      GO TO 5
  144 DO 44 J=1,MDERIV
   44 DERIV(J,3)=DERIV(J,3)-FORCE(J)
      CNTRLS=CNTRLS+.02
      CNTRLP=CNTRLP+.01*FLOAT(ROTAT1)
      GO TO 5
  145 DO 45 J=1,MDERIV
   45 DERIV(J,4)=DERIV(J,4)-FORCE(J)
      CNTRLP=CNTRLP-.01*FLOAT(ROTAT1)
      THETAF=THETAF-.02*FACTOR
      GO TO 5
  146 DO 46 J=1,MDERIV
   46 DERIV(J,5)=DERIV(J,5)-FORCE(J)
      THETAF=THETAF+.02*FACTOR
      PHIF=PHIF-.02
      GO TO 5
  147 DO 47 J=1,MDERIV
   47 DERIV(J,6)=DERIV(J,6)-FORCE(J)
      PHIF=PHIF+.02
      IF (OPTRIM .EQ. 2) GO TO 50
      DO 51 I=1,6
      DERIV(I,7)=0.
   51 DERIV(7,I)=0.
      DERIV(7,7)=1.
      GO TO 52
   50 THETFP=THETFP-.02*FACTOR
      GO TO 5
  148 IF (OPTRIM .NE. 2) GO TO 140
      DO 48 J=1,MDERIV
   48 DERIV(J,7)=DERIV(J,7)-FORCE(J)
      THETFP=THETFP+.02*FACTOR
   52 DO 53 I=1,MDERIV
      DELTA=.02
      IF (I .EQ. 1) DELTA=.01*FACTOR
      IF ((I .EQ. 5) .OR. (I .EQ. 7)) DELTA=.02*FACTOR
      IF (I .EQ. 4) DELTA=-.01*FLOAT(ROTAT1)
      DO 53 J=1,MDERIV
   53 DERIV(J,I)=DERIV(J,I)/DELTA
      CALL MINV(DERIV,7,DEN,LMINV,MMINV)
      DO 54 I=1,MDERIV
      DO 54 J=1,MDERIV
   54 DERIV(J,I)=DERIV(J,I)*FACTOR
      GO TO 5
    6 PRINT 999
      ALPHA=ALPHA*CVERT+IWB
      BETA=BETA*CVERT
      ALFHT=ALFHT*CVERT+IHT
      ALFVT=ALFVT*CVERT+IVT
      DELF=DELF*CVERT
      DELE=DELE*CVERT
      DELA=DELA*CVERT
      DELR=DELR*CVERT
      ANG1=CNTRL0*CVERT
      ANG2=CNTRLS*CVERT
      ANG3=CNTRLC*CVERT
      ANG4=CNTRLP*CVERT
      ANG5=THETAF*CVERT
      ANG6=PHIF*CVERT
      ANG7=THETFP*CVERT
      ANG8=PSIFP*CVERT
      VELC=VEL*SIN(THETFP)
      VELS=VEL*COS(THETFP)*SIN(PSIFP)
      VCLIMB=VELC*VTIP
      VSIDE=VELS*VTIP
      PCLIMB=VCLIMB*AMASS*GRAV/CPOWR(OPUNIT)
      POWR=CQ1*FLOAT(ROTAT1)+CNSTP*CQ2*FLOAT(ROTAT2)
      POWRHP=POWR*FLOAT(NBLAD1)*IB1*OMEGA1**3*GAMMA1*DENSE/CPOWR(OPUNIT)-
     1/5.7
      QUE=.5*DENSE*VEL*VEL*GAMMA1*OMEGA1**2/RADUS1**3*IB1*FLOAT(NBLAD1)/-
     1(3.141593*5.7*SIGMA1)
      FLW=LW*QUE
      FDW=DW*QUE
      FMYW=MYW*QUE
      FYW=YW*QUE
      FMXW=MXW*QUE
      FMZW=MZW*QUE
      FLH=LH*QUE
      FDH=DH*QUE
      FLV=LV*QUE
      FDV=DV*QUE
      PRINT 998, VEL,ALPHA,ANG1,  COLL,VELX,BETA,ANG2,  LNGCYC,VELY,ALFH-
     1T,ANG3,  LATCYC,VELZ,ALFVT,ANG4,  PEDAL,VELC,DELF,ANG5,  APITCH,VE-
     2LS,DELE,ANG6,AROLL,VCLIMB,DELA,ANG7,  ACLIMB,VSIDE,DELR,ANG8, AYAW-
     3,PCLIMB,AFLAP,POWRHP
      IF (OPTRIM) 61,62,63
   61 PRINT 997
      GO TO 64
   62 PRINT 996
      GO TO 65
   63 PRINT 995, ITERC,ITERM,EPTRIM
      IF (OPTRIM .EQ. 2) PRINT 994, GM,PTRIM
      IF (OPTRIM .EQ. 1) PRINT 993, GM
   64 PRINT 992, FORZ,FLW,FLH,FLV,FORX,FDW,FDH,FDV,MOMY,FMYW,FORY,FYW,MO-
     1MX,FMXW,MOMZ,FMZW,POWR
      CALL RTRIMP
      CALL JUGGLE(9)
      CALL RTRIMP
      CALL JUGGLE(8)
   65 CONTINUE
      U2=MU1*MU1+MUY1*MUY1+LAMDA1*LAMDA1
      IF (U2 .GT. 0.) U2=1./SQRT(U2)
      TAUW=SQRT((XWB-XRTR1)**2+(ZWB-ZRTR1)**2)*U2
      TAUH=SQRT((XHT-XRTR1)**2+(ZHT-ZRTR1)**2)*U2
      TAUV=SQRT((XVT-XRTR1)**2+(ZVT-ZRTR1)**2)*U2
      CVRTR1=CVRTR1*U2*(MU1*RSF1(1,2)-MUY1*RSF1(2,2)-LAMDA1*RSF1(3,2))
      U2=U2*(MU1*RSF1(1,3)-MUY1*RSF1(2,3)-LAMDA1*RSF1(3,3))
      CWRTR1=CWRTR1*U2
      CHRTR1=CHRTR1*U2
      U2=MU2*MU2+MUY2*MUY2+LAMDA2*LAMDA2
      IF (U2 .GT. 0.) U2=1./SQRT(U2)
      IF (ORIENT.EQ.1) TAUV=SQRT((XVT-XRTR2)**2+(ZVT-ZRTR2)**2)*U2/OR21
      CVRTR2=CVRTR2*U2*(MU2*RSF2(1,2)-MUY2*RSF2(2,2)-LAMDA2*RSF2(3,2))
      U2=U2*(MU2*RSF2(1,3)-MUY2*RSF2(2,3)-LAMDA2*RSF2(3,3))
      CWRTR2=CWRTR2*U2
      CHRTR2=CHRTR2*U2
      EDAMP=0.
      IF (OPTRIM .NE. 0) EDAMP=EDAMPC*GAMMA1*DENSE*POWR/5.7
      IF (ENGPOS .EQ. 2) EDAMP=EDAMP/RTRANS**2
      IF (OPMOTR .EQ. 3) EDAMP=0.
      X1=CPOWR(OPUNIT)*1.5*NRPOWR/(FLOAT(NBLAD1)*IB1*OMEGA1**3)
      X2=GAMMA1*DENSE*POWR/(5.7*X1)
      X2=4.*X2*(1.-X2)
      IF (X2 .NE. 0.) X2=SQRT(ABS(X2))
      QTHRTL=THRTLC*X1/57.3*X2
      IF (ENGPOS .EQ. 2) QTHRTL=QTHRTL/RTRANS
      RETURN
      END
      SUBROUTINE HLLDE
C
C   ROTORCRAFT DYNAMICS
C   WAYNE JOHNSON          NASA-ARC/USAAMRDL
C   FEBRUARY 1976
C
      COMMON /HLCOEF/A2(6400),A1(6400),A0(6400),B0(2320),MX,MX1,MV,MVG,D-
     1OF1(80)
      INTEGER DOF1
      COMMON  /RCOEF/A2R1(30,30),A1R1(30,30),A0R1(30,30),AA2R1(30,6),AA1-
     1R1(30,6),AA0R1(30,6),BR1(30,8),BGR1(30,3),C2R1(6,30),C1R1(6,30),C0-
     2R1(6,30),CA2R1(6,6),CA1R1(6,6),CA0R1(6,6),DGR1(6,3)
      COMMON /R2COEF/A2R2(30,30),A1R2(30,30),A0R2(30,30),AA2R2(30,6),AA1-
     1R2(30,6),AA0R2(30,6),BR2(30,8),BGR2(30,3),C2R2(6,30),C1R2(6,30),C0-
     2R2(6,30),CA2R2(6,6),CA1R2(6,6),CA0R2(6,6),DGR2(6,3)
      COMMON /BCOEF/CAW(12,16),CB1W(3,3),CB2W(3,3),A2W(16,19),A1W(16,19)-
     1,A0W(16,19),BW(16,4),BGW(16,3),AAW(16,12)
      COMMON /HINPUT/TITLE(18),VTIP,RPM,VEL,VKTS,OPUNIT,ALTMSL,TEMP,ALTA-
     1GL,ACLIMB,AYAW,APITCH,AROLL,COLL,LNGCYC,LATCYC,PEDAL,WEIGHT,AFLAP,-
     2ITER,EPTRIM,FACTOR,PTRIM,DOF(80),CON(26),GUST(3),OPSYMM,DOFSYM(80)-
     3,CONSYM(26),GUSSYM(3),OPFLOW,OPTORS(2),OPMOTR,OPLMDA(2),OPINTR,OPQ-
     4RTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,TONLY,MPER,JCNST,NSYS-
     5AN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP(80),CONP(29),CNTRL0,CNT-
     6RLC,CNTRLS,CNTRLP,THETFP,PSIFP,THETAF,PHIF,VELX,VELY,VELZ,GRAV,DEN-
     7SE,CSOUND,FREQ(100)
      COMMON /GINPUT/ORIENT,ASHAFT(2),ACANT(2),K12H,K12F,K12L,K21H,K21F,-
     1K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR-
     22,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,TAUH,TAUV,RTRANS,IENG,KMAST1,KM-
     3AST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,TH-
     4RTLC,NRPOWR,EDAMPC,KPMC1(10),KPMS1(10),KPMC2(10),KPMS2(10),FSR1,WL-
     5R1,BLR1,FSR2,WLR2,BLR2,FSCG,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX-
     6,IYY,IZZ,IXZ,XRTR1,YRTR1,ZRTR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,X-
     7VT,ZVT,AMASS,AIXX,AIYY,AIZZ,AIXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCF-
     8E,PRCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCC-
     9FE,PSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ(11),TCFE-
     A(11,5),QMASS(10),QFREQ(10),QDAMP(10),ZETAR1(3,10),ZETAR2(3,10),GAM-
     BAR1(3,10),GAMAR2(3,10),NEM,RSF1(3,3),RSF2(3,3),RFV(3,3),RSV1(3,3),-
     CRSV2(3,3),ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,EDAMP,QTHRTL
      INTEGER OPUNIT,ORIENT,DOF,CON,GUST,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPF-
     1LOW,OPTORS,OPMOTR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND-
     2,OPAERO,DEBUG,TONLY,RESPON,DOFP,CONP,ENGPOS
      REAL LNGCYC,LATCYC,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWR-
     1TR2,KHRTR1,KHRTR2,KVRTR1,KVRTR2,IENG,KMAST1,KMAST2,KICS,KENG,KPR1G-
     2V,KIR1GV,KPR2GV,KIR2GV,KPEGOV,KIEGOV,NRPOWR,KPMC1,KPMC2,KPMS1,KPMS-
     32,IXX,IYY,IZZ,IXZ,KFCCFE,KRCCFE,KFPCFE,KRPCFE,KF0CFE,KR0CFE,KFSCFE-
     4,KRSCFE,KCCFE,KSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,LMDA-
     501,LMDA02
      COMMON /R1DATA/HHR1(667)
      EQUIVALENCE (RADUS1,HHR1(14)),(VTIPN1,HHR1(79)),(IB1,HHR1(32)),(NB-
     1LAD1,HHR1(2)),(NBM1,HHR1(9)),(NTM1,HHR1(10)),(OMEGA1,HHR1(13)),(GI-
     2MBL1,HHR1(11)),(KPB1(1),HHR1(50)),(KPG1,HHR1(35)),(TRC1,HHR1(21)),-
     3(TRS1,HHR1(22)),(MU1,HHR1(6)),(MUY1,HHR1(88)),(MUZ1,HHR1(89)),(LAM-
     4DA1,HHR1(7)),(KHLMD1,HHR1(655)),(KFLMD1,HHR1(656)),(GAMMA1,HHR1(12-
     5)),(SIGMA1,HHR1(15)),(OPAER1,HHR1(16)),(OPMOD1,HHR1(26)),(ROTAT1,H-
     6HR1(663))
      INTEGER GIMBL1,OPAER1,OPMOD1,ROTAT1
      REAL MU1,MUY1,MUZ1,LAMDA1,KHLMD1,KFLMD1,KPB1(5),KPG1,IB1
      COMMON /R2DATA/HHR2(667)
      EQUIVALENCE (RADUS2,HHR2(14)),(VTIPN2,HHR2(79)),(IB2,HHR2(32)),(NB-
     1LAD2,HHR2(2)),(NBM2,HHR2(9)),(NTM2,HHR2(10)),(OMEGA2,HHR2(13)),(GI-
     2MBL2,HHR2(11)),(KPB2(1),HHR2(50)),(KPG2,HHR2(35)),(TRC2,HHR2(21)),-
     3(TRS2,HHR2(22)),(MU2,HHR2(6)),(MUY2,HHR2(88)),(MUZ2,HHR2(89)),(LAM-
     4DA2,HHR2(7)),(KHLMD2,HHR2(655)),(KFLMD2,HHR2(656)),(GAMMA2,HHR2(12-
     5)),(SIGMA2,HHR2(15)),(OPAER2,HHR2(16)),(OPMOD2,HHR2(26)),(ROTAT2,H-
     6HR2(663))
      INTEGER GIMBL2,OPAER2,OPMOD2,ROTAT2
      REAL MU2,MUY2,MUZ2,LAMDA2,KHLMD2,KFLMD2,KPB2(5),KPG2,IB2
      NAMELIST /NLHL/VTIP,RPM,VEL,VKTS,VELX,VELY,VELZ,WEIGHT,ASHAFT,ACAN-
     1T,ORIENT,ACLIMB,AYAW,APITCH,AROLL,THETFP,PSIFP,THETAF,PHIF,ALTMSL,-
     2TEMP,ALTAGL,DENSE,CSOUND,ALTD,GRAV,COLL,LNGCYC,LATCYC,PEDAL,AFLAP,-
     3DOF,CON,GUST,OPUNIT,OPSYMM,DOFSYM,CONSYM,GUSSYM,OPFLOW,OPTORS,OPMO-
     4TR,OPLMDA,OPINTR,OPQRTR,OPTRIM,OPGOVR,OPREAD,OPGRND,OPAERO,DEBUG,T-
     5ONLY,MPER,JCNST,NSYSAN,NSTEP,NFREQ,LOCUS,PLOTMX,RESPON,NF,DOFP,CON-
     6P,ITER,EPTRIM,FACTOR,PTRIM,FREQ,FSR1,WLR1,BLR1,FSR2,WLR2,BLR2,FSCG-
     7,WLCG,FSWB,WLWB,FSHT,WLHT,FSVT,WLVT,IXX,IYY,IZZ,IXZ,XRTR1,YRTR1,ZR-
     8TR1,XRTR2,YRTR2,ZRTR2,XWB,ZWB,XHT,ZHT,XVT,ZVT,AMASS,AIXX,AIYY,AIZZ-
     9,AIXZ,RSF1,RSF2,RFV,RSV1,RSV2,KFCCFE,KRCCFE,KFPCFE,KRPCFE,PFCCFE,P-
     ARCCFE,PFPCFE,PRPCFE,KF0CFE,KR0CFE,KFSCFE,KRSCFE,KCCFE,KSCFE,PCCFE,-
     BPSCFE,K0CFE,KPCFE,KFCFE,KACFE,KECFE,KRCFE,KTCFE,CNTRLZ,TCFE,CNTRL0-
     C,CNTRLC,CNTRLS,CNTRLP,QMASS,QFREQ,QDAMP,ZETAR1,ZETAR2,GAMAR1,GAMAR-
     D2,NEM,K12H,K12F,K12L,K21H,K21F,K21L,KLTRIM,KWRTR1,KWRTR2,KHRTR1,KH-
     ERTR2,KVRTR1,KVRTR2,CWRTR1,CWRTR2,CHRTR1,CHRTR2,CVRTR1,CVRTR2,TAUW,-
     FTAUH,TAUV,RTRANS,IENG,KMAST1,KMAST2,KICS,KENG,ENGPOS,KPR1GV,KIR1GV-
     G,KPR2GV,KIR2GV,KPEGOV,KIEGOV,THRTLC,NRPOWR,EDAMPC,KPMC1,KPMS1,KPMC-
     H2,KPMS2,EDAMP,QTHRTL,ZAGL1,ZAGL2,CSEGE1,CSEGE2,LMDA01,LMDA02,DLDZ1-
     I,DLDZ2,CNSTL1,CNSTL2,VTIP2,RPM2,TITLE
      NAMELIST /NLEQ/A2,A1,A0,B0,MX,MX1,MV,MVG,MX0,DOF0,DOF1
      NAMELIST /NLR/A2R1,A1R1,A0R1,AA2R1,AA1R1,AA0R1,BR1,BGR1,C2R1,C1R1,-
     1C0R1,CA2R1,CA1R1,CA0R1,DGR1,A2R2,A1R2,A0R2,AA2R2,AA1R2,AA0R2,BR2,B-
     2GR2,C2R2,C1R2,C0R2,CA2R2,CA1R2,CA0R2,DGR2
      NAMELIST /NLS/CAW,CB1W,CB2W,A2W,A1W,A0W,BW,BGW,AAW
      REAL B(2080),BG(240),PHI(1800)
      EQUIVALENCE (B0(1),B(1)),(B0(2081),BG(1))
      INTEGER DOF0(80)
      REAL CKNOT(2),C2H(16,12),C1H(16,12),C0H(16,12),BGH1(30,3),BGH2(30,-
     13),DGH1(6,3),DGH2(6,3)
      EQUIVALENCE (B0(1),BGH1(1,1)),(B0(91),BGH2(1,1)),(B0(181),DGH1(1,1-
     1)),(B0(199),DGH2(1,1))
      DATA CVERT/57.29578/
      DATA CKNOT/.5924838,1.943845/
  999 FORMAT (1H1/1X,'ROTORCRAFT EQUATIONS OF MOTION',10X,18A4/)
  994 FORMAT (1X,'OPERATING STATE',59X,'ROTOR PARAMETERS',13X,'MAIN',5X,-
     1'TAIL')
  993 FORMAT (1X,'OPERATING STATE',59X,'ROTOR PARAMETERS',13X,'FRONT',4X-
     1,'REAR')
  998 FORMAT (6X,'VELOCITY (KNOTS) =',F8.2,10X,'ALTITUDE MSL (FT OR M) =-
     1',F7.0,6X,'TIP SPEED (FPS OR MPS) =',2F9.2)
  997 FORMAT (6X,'V/(OMEGA*R)      =',F8.4,10X,'TEMPERATURE (F OR C) =',-
     1F7.2,9X,'ROTATIONAL SPEED (RPM) =',2F9.2)
  996 FORMAT (6X,'V/(OMEGA*R)      =',F8.4,10X,'STANDARD DAY',25X,'ROTAT-
     1IONAL SPEED (RPM) =',2F9.2)
  995 FORMAT (6X,'THETA-FP (DEG) =',F7.2,13X,'PRESSURE ALT (FT OR M) =',-
     1F7.0,6X,'RADIUS (FT OR M) =',6X,2F9.2/                            -
     26X,'PSI-FP (DEG)   =',F7.2,13X,'AIR DENSITY RATIO =',F7.4,11X,'OME-
     3GA (RAD/SEC)  =',6X,2F9.2/                                        -
     46X,'CLIMB SPEED (FPS OR MPS) =',F7.2,3X,'SOUND SPEED =',F8.2,16X,'-
     5IB (SLUG-FT2 OR KG-M2) =',2F9.2/                                  -
     66X,'SIDE SPEED (FPS OR MPS)  =',F7.2,40X,'NUMBER OF BLADES =',4X,2-
     7I9/6X,'ALTITUDE AGL (FT OR M) =',F8.2,41X,'LOCK NUMBER      =',6X,-
     82F9.3/6X,'GROSS WEIGHT (LB OR KG) =',F8.0,40X,'ROTOR SOLIDITY   ='-
     9,6X,2F9.3)
  984 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',11X,'CNTR',5X,'CNTR')
  983 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',11X,'CNTR',4X,'CLOCK')
  982 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',10X,'CLOCK',5X,'CNTR')
  981 FORMAT (6X,'CG STATION (FT OR M) =',F9.3,42X,                     -
     1            'ROTATION DIRECTION',10X,'CLOCK',4X,'CLOCK')
  992 FORMAT ( /1X,'OPTIONS'/                                           -
     110X,'OPSYMM =',I2,7X,'IF 1, SYMMETRIC/ IF -1, ANTISYMMETRIC'/     -
     210X,'OPFLOW =',I2,7X,'IF 0, AXIAL FLOW/ LT 0, CONSTANT COEFF'/    -
     3                  10X,'OPTRIM =',I2,7X,'IF 0, NO TRIM/ LT 0, NO IT-
     5ERATION/IF 1, TRIM F,M/ IF 2, TRIM F,M,P'/                        -
     610X,'OPMOTR =',I2,7X,'IF 0, AUTOROTATION/ IF 1, CONSTANT SPEED/ IF-
     7 2, MOTOR/ IF 3, POWER OUT'/10X,'OPGOVR =',I2,7X,'IF 0, NO GOVERNO-
     8R'/10X,'OPGRND =',I2,7X,'IF 0, OUT OF GROUND EFFECT'/             -
     A10X,'OPAERO =',I2,7X,'IF 0, NO PERTURBATION AIRCRAFT AERO FORCES'/-
     B10X,'OPMODE =',2I2,5X,'IF 0, RIGID BLADE MODES/IF 2, READ MODES/ I-
     CF 3, PUNCH MODES/ IF 4, ARTICULATED MODES'/10X,'OPAERO =',2I2,5X,'-
     DIF 0, ONLY CLA TERMS IN ROTOR AERO/ LT 0, NO STALL'/              -
     F10X,'OPTORS =',2I2,5X,'IF 0, DOF/ IF 1, RIGID/ IF 2, QUASISTATIC'/-
     G10X,'OPLMDA =',2I2,5X,'IF 0, QUASISTATIC INFLOW DYNAMICS'/        -
     H10X,'OPINTR =',I2,7X,'IF 0, QUASISTATIC AERODYNAMIC INTERFERENCE'/-
     I10X,'OPQRTR =',I2,7X,'IF 1, QUASISTATIC ROTOR-1/ IF 2, ROTOR-2/ IF-
     J 3, BOTH ROTORS/ IF 4, ALL Q-S EXCEPT RIGID BODY')
  980 FORMAT (1X,'SINGLE MAIN ROTOR/TAIL ROTOR CONFIGURATION')
  979 FORMAT (1X,'TANDEM ROTOR CONFIGURATION')
  991 FORMAT (/   1X,'ORDER OF VARIABLES'/10X,'DOF = B0,B1C,B1S,BNC,BNS,-
     1BN/2   T0,T1C,T1S,TNC,TNS,TN/2   BGC,BGS,PSI   L0,LC,LS',10X,'(ROT-
     2OR-1 AND ROTOR-2)'/16X,'PSIE   PHIF,TF,PSIF,XF,YF,ZF   ELASTIC   L-
     3W,LH,LV'/10X,'CON = T0,T1C,T1S,TNC,TNS,TN/2 (ROTOR-1 AND ROTOR-2) -
     4     TT   DF,DE,DA,DF   D0,D1C,D1S,DP,DT'/10X,'GUST = UG,VG,WG')
  989 FORMAT ( /10X,'DOF =',1X,15I1,3X,9I1,3X,3I1,3X,3I1/16X,15I1,3X,9I1-
     1,3X,3I1,3X,3I1,16X,I1,3X,6I1,3X,10I1,3X,3I1/10X,'CON =',1X,8I1,3X,-
     28I1,3X,I1,3X,4I1,3X,5I1/10X,'GUST =',1X,3I1)
  988 FORMAT ( /1X,'COMPUTATION PARAMETERS',15X,'CSYSAN - STEPS =',I4//)
  986 FORMAT (1X,'ENGLISH UNITS (FT, SLUG, SEC)')
  985 FORMAT (1X,'METRIC UNITS (M, KG, SEC)')
      VEL=0.
      VKTS=0.
      VTIP=0.
      RPM=0.
      READ (5,NLHL)
      IF ((OPUNIT.NE.1).AND.(OPUNIT.NE.2)) OPUNIT=1
      IF ((RPM .NE. 0.) .AND. (VTIP .EQ. 0.)) VTIP=RADUS1*RPM*.1047198
      IF (VTIP .EQ. 0.) VTIP=VTIPN1
      IF (RPM .EQ. 0.) RPM=VTIP/RADUS1/.1047198
      IF (VEL .EQ. 0.) VEL=VKTS/VTIP/CKNOT(OPUNIT)
      IF (VKTS .EQ. 0.) VKTS=VEL*VTIP*CKNOT(OPUNIT)
      VTIP2=RADUS2/RADUS1*RTRANS*VTIP
      RPM2=RTRANS*RPM
      CALL AIR(ALTMSL,TEMP,DENSE,CSOUND,GRAV,ALTD,OPUNIT)
      CALL HLII(T751,T1C1,T1S1,T752,T1C2,T1S2,1)
      CALL JUGGLE(1)
      CALL RTRII(OPREAD,DEBUG,VTIP,T751,T1C1,T1S1,DENSE,CSOUND,OPUNIT)
      CALL JUGGLE(2)
      CALL RTRII(OPREAD,DEBUG,VTIP2,T752,T1C2,T1S2,DENSE,CSOUND,OPUNIT)
      CALL JUGGLE(3)
      IF (OPFLOW .GT. 0) OPFLOW=-1
      IF ((OPMOTR .NE. 0) .AND. (OPMOTR .NE. 3)) GO TO 120
      PTRIM=0.
      IF (OPTRIM .GT. 0) OPTRIM=2
  120 IF (OPMOTR .EQ. 1) OPGOVR=0
      DO 20 K=1,80
      IF (DOF(K) .NE. 0) DOF(K)=1
      IF (NBLAD1 .NE. 2) GO TO 121
      IF ((K .GE. 11) .AND. (K .LE. 15)) DOF(K)=0
      IF ((K .GE. 22) .AND. (K .LE. 24)) DOF(K)=0
  121 IF (NBLAD2 .NE. 2) GO TO 122
      IF ((K .GE. 41) .AND. (K .LE. 45)) DOF(K)=0
      IF ((K .GE. 52) .AND. (K .LE. 54)) DOF(K)=0
  122 IF (OPSYMM) 221,222,223
  221 IF ((DOFSYM(K) .EQ. 1) .OR. (DOFSYM(K) .EQ. 9)) DOF(K)=0
      GO TO 222
  223 IF ((DOFSYM(K) .EQ.-1) .OR. (DOFSYM(K) .EQ. 9)) DOF(K)=0
  222 IF (K .GT. 26) GO TO 20
      IF (CON(K) .NE. 0) CON(K)=1
      IF ((K .GT. NBLAD1) .AND. (K .LE. 8)) CON(K)=0
      IF ((K .GT. NBLAD2+8) .AND. (K .LE. 16)) CON(K)=0
      IF (OPSYMM) 224,225,226
  224 IF ((CONSYM(K) .EQ. 1) .OR. (CONSYM(K) .EQ. 9)) CON(K)=0
      GO TO 225
  226 IF ((CONSYM(K) .EQ.-1) .OR. (CONSYM(K) .EQ. 9)) CON(K)=0
  225 IF (K .GT. 3) GO TO 20
      IF (GUST(K) .NE. 0) GUST(K)=1
      IF (OPSYMM) 227,20,229
  227 IF ((GUSSYM(K) .EQ. 1) .OR. (GUSSYM(K) .EQ. 9)) GUST(K)=0
      GO TO 20
  229 IF ((GUSSYM(K) .EQ.-1) .OR. (GUSSYM(K) .EQ. 9)) GUST(K)=0
   20 CONTINUE
      IF (NBLAD1 .EQ. 2) DOF(26)=0
      IF (NBLAD2 .EQ. 2) DOF(56)=0
      IF (GIMBL1 .EQ. 0) DOF(25)=0
      IF (GIMBL1 .EQ. 0) DOF(26)=0
      IF (GIMBL2 .EQ. 0) DOF(55)=0
      IF (GIMBL2 .EQ. 0) DOF(56)=0
      IF (OPMOTR .EQ. 1) DOF(27)=0
      IF (OPMOTR .EQ. 1) DOF(57)=0
      IF (OPMOTR .LE. 1) DOF(61)=0
      IF (OPGRND .NE. 0) DOF(28)=1
      IF ((OPGRND .NE. 0) .AND. (ORIENT .EQ. 2)) DOF(58)=1
      IF (OPTORS(1) .EQ. 0) GO TO 123
      DO 124 K=16,24
      IF (OPTORS(1) .EQ. 1) DOF(K)=0
      IF ((OPTORS(1) .EQ. 2) .AND. (K .LE. 15+NBLAD1)) DOF(K)=1
  124 CONTINUE
  123 IF (OPTORS(2) .EQ. 0) GO TO 125
      DO 126 K=46,54
      IF (OPTORS(2) .EQ. 1) DOF(K)=0
      IF ((OPTORS(2) .EQ. 2) .AND. (K .LE. 45+NBLAD2)) DOF(K)=1
  126 CONTINUE
  125 NBM1=0
      DO 22 K=1,5
      DO 22 KB=1,NBLAD1
      J=(K-1)*NBLAD1+KB
      IF (J .GT. 15) GO TO 22
      IF (DOF(J) .NE. 0) NBM1=K
   22 CONTINUE
      NBM1=MAX0(1,NBM1)
      NTM1=0
      DO 24 K=1,3
      DO 24 KB=1,NBLAD1
      J=(K-1)*NBLAD1+KB
      IF (J .GT. 9) GO TO 24
      IF (DOF(J+15) .NE. 0) NTM1=K
   24 CONTINUE
      NTM1=MAX0(1,NTM1)
      NBM2=0
      DO 23 K=1,5
      DO 23 KB=1,NBLAD2
      J=(K-1)*NBLAD2+KB
      IF (J .GT. 15) GO TO 23
      IF (DOF(J+30) .NE. 0) NBM2=K
   23 CONTINUE
      NBM2=MAX0(1,NBM2)
      NTM2=0
      DO 25 K=1,3
      DO 25 KB=1,NBLAD2
      J=(K-1)*NBLAD2+KB
      IF (J .GT. 9) GO TO 25
      IF (DOF(J+45) .NE. 0) NTM2=K
   25 CONTINUE
      NTM2=MAX0(1,NTM2)
      NEM=0
      DO 26 K=1,10
      IF (DOF(K+67) .NE. 0) NEM=K
   26 CONTINUE
      NEM=MAX0(1,NEM)
      VCLIMB=VEL*VTIP*SIN(ACLIMB/CVERT)
      VSIDE=VEL*VTIP*COS(ACLIMB/CVERT)*SIN(AYAW/CVERT)
      PRINT 999, (TITLE(I), I=1,18)
      IF (ORIENT .EQ. 1) PRINT 994
      IF (ORIENT .EQ. 2) PRINT 993
      PRINT 998, VKTS,ALTMSL,VTIP,VTIP2
      IF (TEMP .LE. 999.)  PRINT 997, VEL,TEMP,RPM,RPM2
      IF (TEMP .GE. 1000.) PRINT 996, VEL,RPM,RPM2
      PRINT 995, ACLIMB,ALTD,RADUS1,RADUS2,AYAW,DENSE,OMEGA1,OMEGA2,VCLI-
     1MB,CSOUND,IB1,IB2,VSIDE,NBLAD1,NBLAD2,ALTAGL,GAMMA1,GAMMA2,WEIGHT,-
     2SIGMA1,SIGMA2
      IF ((ROTAT1 .EQ.  1) .AND. (ROTAT2 .EQ.  1)) PRINT 984, FSCG
      IF ((ROTAT1 .EQ.  1) .AND. (ROTAT2 .EQ. -1)) PRINT 983, FSCG
      IF ((ROTAT1 .EQ. -1) .AND. (ROTAT2 .EQ.  1)) PRINT 982, FSCG
      IF ((ROTAT1 .EQ. -1) .AND. (ROTAT2 .EQ. -1)) PRINT 981, FSCG
      IF (ORIENT .EQ. 1) PRINT 980
      IF (ORIENT .EQ. 2) PRINT 979
      PRINT 992, OPSYMM,OPFLOW,OPTRIM,OPMOTR,OPGOVR,OPGRND,OPAERO,OPMOD1-
     1,OPMOD2,OPAER1,OPAER2,OPTORS(1),OPTORS(2),OPLMDA(1),OPLMDA(2),OPIN-
     2TR,OPQRTR
      PRINT 991
      PRINT 989, (DOF(I), I=1,80),(CON(I), I=1,26),(GUST(I), I=1,3)
      PRINT 988, JCNST
      IF (OPUNIT .EQ. 1) PRINT 986
      IF (OPUNIT .EQ. 2) PRINT 985
      CALL HLII(T751,T1C1,T1S1,T752,T1C2,T1S2,2)
      CALL JUGGLE(1)
      CALL MODE
      CALL JUGGLE(4)
      CALL MODE
      CALL JUGGLE(5)
      CALL HLTRIM
      IF (TONLY .NE. 0) GO TO 101
      IF (DEBUG .GE. 2) WRITE(6,NLHL)
      GO TO 1
  101 CONTINUE
      NBLD1=NBLAD1
      NBLD2=NBLAD2
      IF (OPFLOW .LT. 0) NBLD1=JCNST
      IF (OPFLOW .LT. 0) NBLD2=JCNST
      PSI=0.
      CALL JUGGLE(11)
      IF ((NBLAD2.GE.3).AND.(OPFLOW.EQ.0)) CALL ROTOR0
      IF ((NBLAD2.GE.3).AND.(OPFLOW.NE.0)) CALL ROTOR(OPFLOW,PSI,NBLD2)
      IF (NBLAD2 .EQ. 2) CALL ROTOR2(OPFLOW,PSI,NBLD2)
      CALL JUGGLE(10)
      IF ((NBLAD1.GE.3).AND.(OPFLOW.EQ.0)) CALL ROTOR0
      IF ((NBLAD1.GE.3).AND.(OPFLOW.NE.0)) CALL ROTOR(OPFLOW,PSI,NBLD1)
      IF (NBLAD1 .EQ. 2) CALL ROTOR2(OPFLOW,PSI,NBLD1)
      CALL HLBODY
      CNSTO=OMEGA1/OMEGA2
      CNSTO2=CNSTO**2
      CNSTR=RADUS1/RADUS2
      CNSTOR=CNSTO*CNSTR
      CNSTM=(FLOAT(NBLAD2)*IB2*OMEGA2**2)/(FLOAT(NBLAD1)*IB1*OMEGA1**2)
      CNSTF=CNSTM*CNSTR
      DO 431 K=1,30
      DO 432 I=1,30
      A2R2(K,I)=A2R2(K,I)*CNSTO2
  432 A1R2(K,I)=A1R2(K,I)*CNSTO
      DO 431 I=1,6
      AA2R2(K,I)=AA2R2(K,I)*CNSTO2
      AA1R2(K,I)=AA1R2(K,I)*CNSTO
      IF (I .LE. 3) BGR2(K,I)=BGR2(K,I)*CNSTOR
  431 CONTINUE
      DO 433 K=1,6
      DO 434 I=1,30
      C2R2(K,I)=C2R2(K,I)*CNSTO2
  434 C1R2(K,I)=C1R2(K,I)*CNSTO
      DO 433 I=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTO2
      CA1R2(K,I)=CA1R2(K,I)*CNSTO
      IF (I .LE. 3) DGR2(K,I)=DGR2(K,I)*CNSTOR
  433 CONTINUE
      DO 435 I=1,3
      DO 436 K=1,30
      AA2R2(K,I)=AA2R2(K,I)*CNSTR
      AA1R2(K,I)=AA1R2(K,I)*CNSTR
  436 AA0R2(K,I)=AA0R2(K,I)*CNSTR
      DO 435 K=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTR
      CA1R2(K,I)=CA1R2(K,I)*CNSTR
  435 CA0R2(K,I)=CA0R2(K,I)*CNSTR
      DO 437 K=1,3
      DO 438 I=1,30
      C2R2(K,I)=C2R2(K,I)*CNSTF
      C1R2(K,I)=C1R2(K,I)*CNSTF
      C0R2(K,I)=C0R2(K,I)*CNSTF
      C2R2(K+3,I)=C2R2(K+3,I)*CNSTM
      C1R2(K+3,I)=C1R2(K+3,I)*CNSTM
  438 C0R2(K+3,I)=C0R2(K+3,I)*CNSTM
      DO 437 I=1,6
      CA2R2(K,I)=CA2R2(K,I)*CNSTF
      CA1R2(K,I)=CA1R2(K,I)*CNSTF
      CA0R2(K,I)=CA0R2(K,I)*CNSTF
      CA2R2(K+3,I)=CA2R2(K+3,I)*CNSTM
      CA1R2(K+3,I)=CA1R2(K+3,I)*CNSTM
      CA0R2(K+3,I)=CA0R2(K+3,I)*CNSTM
      IF (I .GT. 3) GO TO 437
      DGR2(K,I)=DGR2(K,I)*CNSTF
      DGR2(K+3,I)=DGR2(K+3,I)*CNSTM
  437 CONTINUE
      DO 131 I=1,3
      DO 132 K=1,30
      BGH1(K,I)=0.
      BGH2(K,I)=0.
      DO 132 J=1,3
      BGH1(K,I)=BGH1(K,I)+BGR1(K,J)*RSV1(J,I)
  132 BGH2(K,I)=BGH2(K,I)+BGR2(K,J)*RSV2(J,I)
      DO 133 K=1,6
      DGH1(K,I)=0.
      DGH2(K,I)=0.
      DO 133 J=1,3
      DGH1(K,I)=DGH1(K,I)+DGR1(K,J)*RSV1(J,I)
  133 DGH2(K,I)=DGH2(K,I)+DGR2(K,J)*RSV2(J,I)
  131 CONTINUE
      DO 134 I=1,3
      DO 135 K=1,30
      BGR1(K,I)=BGH1(K,I)
  135 BGR2(K,I)=BGH2(K,I)
      DO 134 K=1,6
      DGR1(K,I)=DGH1(K,I)
  134 DGR2(K,I)=DGH2(K,I)
      DO 136 I=1,3
      DO 136 K=1,16
      BGH1(K,I)=0.
      DO 136 J=1,3
  136 BGH1(K,I)=BGH1(K,I)+BGW(K,J)*RFV(J,I)
      DO 137 I=1,3
      DO 137 K=1,16
  137 BGW(K,I)=BGH1(K,I)
      DO 31 I=1,6400
      A2(I)=0.
      A1(I)=0.
   31 A0(I)=0.
      DO 32 I=1,2320
   32 B0(I)=0.
      DO 33 I=1,30
      DO 33 K=1,30
      JA=(I-1)*80+K
      A2(JA)=A2R1(K,I)
      A1(JA)=A1R1(K,I)
      A0(JA)=A0R1(K,I)
      JA=(I+29)*80+K+30
      A2(JA)=A2R2(K,I)
      A1(JA)=A1R2(K,I)
   33 A0(JA)=A0R2(K,I)
      DO 34 I=1,8
      DO 34 K=1,30
      JB=(I-1)*80+K
      B(JB)=BR1(K,I)
      JB=(I+7)*80+K+30
   34 B(JB)=BR2(K,I)
      DO 35 I=1,3
      DO 35 K=1,30
      JB=(I-1)*80+K
      BG(JB)=BGR1(K,I)
   35 BG(JB+30)=BGR2(K,I)
      DO 41 I=1,16
      DO 41 K=1,30
      JA1=(I+60)*80+K
      JA2=JA1+30
      DO 41 J=1,6
      A2(JA1)=A2(JA1)+AA2R1(K,J)*CAW(J,I)
      A2(JA2)=A2(JA2)+AA2R2(K,J)*CAW(J+6,I)
      A1(JA1)=A1(JA1)+AA1R1(K,J)*CAW(J,I)
      A1(JA2)=A1(JA2)+AA1R2(K,J)*CAW(J+6,I)
      IF (I .LE. 3) GO TO 41
      A0(JA1)=A0(JA1)+AA0R1(K,J)*CAW(J,I)
      A0(JA2)=A0(JA2)+AA0R2(K,J)*CAW(J+6,I)
   41 CONTINUE
      DO 42 I=1,30
      DO 42 K=1,16
      JA1=(I-1)*80+K+61
      JA2=(I+29)*80+K+61
      DO 42 J=1,6
      A2(JA1)=A2(JA1)-AAW(K,J)*C2R1(J,I)
      A1(JA1)=A1(JA1)-AAW(K,J)*C1R1(J,I)
      A0(JA1)=A0(JA1)-AAW(K,J)*C0R1(J,I)
      A2(JA2)=A2(JA2)-AAW(K,J+6)*C2R2(J,I)
      A1(JA2)=A1(JA2)-AAW(K,J+6)*C1R2(J,I)
   42 A0(JA2)=A0(JA2)-AAW(K,J+6)*C0R2(J,I)
      DO 43 I=1,6
      DO 43 K=1,16
      C2H(K,I)=0.
      C1H(K,I)=0.
      C0H(K,I)=0.
      C2H(K,I+6)=0.
      C1H(K,I+6)=0.
      C0H(K,I+6)=0.
      DO 43 J=1,6
      C1H(K,I)=C1H(K,I)+AAW(K,J)*CA1R1(J,I)
      C0H(K,I)=C0H(K,I)+AAW(K,J)*CA0R1(J,I)
      C1H(K,I+6)=C1H(K,I+6)+AAW(K,J+6)*CA1R2(J,I)
      C0H(K,I+6)=C0H(K,I+6)+AAW(K,J+6)*CA0R2(J,I)
      IF ((I .LE. 3) .OR. (J .LE. 3)) GO TO 43
      C2H(K,I)=C2H(K,I)+AAW(K,J)*CA2R1(J,I)
      C2H(K,I+6)=C2H(K,I+6)+AAW(K,J+6)*CA2R2(J,I)
   43 CONTINUE
      DO 44 I=1,19
      DO 44 K=1,16
      JA=(I+60)*80+K+61
      A2(JA)=A2W(K,I)
      A1(JA)=A1W(K,I)
      A0(JA)=A0W(K,I)
      IF (I .GT. 16) GO TO 44
      DO 48 J=1,12
      A2(JA)=A2(JA)-C2H(K,J)*CAW(J,I)
      A1(JA)=A1(JA)-C1H(K,J)*CAW(J,I)
      IF (I .LE. 3) GO TO 48
      A0(JA)=A0(JA)-C0H(K,J)*CAW(J,I)
   48 CONTINUE
   44 CONTINUE
      DO 45 I=1,3
      DO 45 K=1,30
      JA1=(I+60)*80+K
      JA2=JA1+30
      DO 45 J=1,3
      A1(JA1)=A1(JA1)+AA2R1(K,J)*CB1W(J,I)
      A1(JA2)=A1(JA2)+AA2R2(K,J)*CB2W(J,I)
      IF (K .GT. 16) GO TO 45
      A1(JA2+31)=A1(JA2+31)-C2H(K,J)*CB1W(J,I)-C2H(K,J+6)*CB2W(J,I)
   45 CONTINUE
      DO 46 I=1,4
      DO 46 K=1,16
      JB=(I+16)*80+K+61
   46 B(JB)=BW(K,I)
      DO 47 I=1,3
      DO 47 K=1,16
      JB=(I-1)*80+K+61
      BG(JB)=BGW(K,I)
      DO 47 J=1,6
   47 BG(JB)=BG(JB)+AAW(K,J)*DGR1(J,I)+AAW(K,J+6)*DGR2(J,I)
      CNSTL1=SQRT((MU1**2+MUY1**2)/KFLMD1**2+LMDA01**2/KHLMD1**4)
      CNSTL1=GAMMA1/(SIGMA1*5.7)*DENSE*2.*(CNSTL1+(LMDA01-MUZ1)*LMDA01/K-
     1HLMD1**4/CNSTL1)
      CNSTL2=SQRT((MU2**2+MUY2**2)/KFLMD2**2+LMDA02**2/KHLMD2**4)
      CNSTL2=GAMMA2/(SIGMA2*5.7)*DENSE*2.*(CNSTL2+(LMDA02-MUZ2)*LMDA02/K-
     1HLMD2**4/CNSTL2)
      CNST12=K12L/CNSTOR*CNSTL1/CNSTL2
      CNST21=K21L*CNSTOR/CNSTL1*CNSTL2
      DO 241 I=1,80
      JA1=(I-1)*80+28
      JA2=JA1+30
      HOLD=A1(JA1)
      A1(JA1)=HOLD+CNST12*A1(JA2)
      A1(JA2)=A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=HOLD+CNST12*A0(JA2)
      A0(JA2)=A0(JA2)+CNST21*HOLD
      IF (I .GT. 3) GO TO 241
      HOLD=BG(JA1)
      BG(JA1)=HOLD+CNST12*BG(JA2)
      BG(JA2)=BG(JA2)+CNST21*HOLD
  241 CONTINUE
      CNST1=GAMMA1/(SIGMA1*5.7)*DENSE
      A2(2188)=A2(2188)+.85*CNST1
      A2(2269)=A2(2269)+.22*CNST1
      A2(2350)=A2(2350)+.22*CNST1
      CNST1=CNST1*SQRT((MU1**2+MUY1**2)/KFLMD1**2+LMDA01**2/KHLMD1**4)
      A1(2269)=A1(2269)+CNST1
      A1(2350)=A1(2350)+CNST1
      A1(2188)=A1(2188)+CNSTL1
      CNST1=GAMMA2/(SIGMA2*5.7)*DENSE
      A2(4618)=A2(4618)+.85*CNST1
      A2(4699)=A2(4699)+.22*CNST1
      A2(4780)=A2(4780)+.22*CNST1
      CNST1=CNST1*SQRT((MU2**2+MUY2**2)/KFLMD2**2+LMDA02**2/KHLMD2**4)
      A1(4699)=A1(4699)+CNST1
      A1(4780)=A1(4780)+CNST1
      A1(4618)=A1(4618)+CNSTL2
      IF (OPMOTR .LE. 1) GO TO 140
      IF (ENGPOS .EQ. 2) GO TO 141
      CNST1=1.
      CNST12=RTRANS
      CNST21=0.
      CNST2=1.
      GO TO 142
  141 CNST1=1./RTRANS
      CNST12=1.
      CNST21=1.
      CNST2=0.
  142 DO 143 I=1,80
      JA1=I+2080
      JA2=I+4480
      HOLD=A2(JA1)
      A2(JA1)=CNST1*HOLD+CNST12*A2(JA2)
      A2(JA2)=CNST2*A2(JA2)+CNST21*HOLD
      HOLD=A1(JA1)
      A1(JA1)=CNST1*HOLD+CNST12*A1(JA2)
      A1(JA2)=CNST2*A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=CNST1*HOLD+CNST12*A0(JA2)
  143 A0(JA2)=CNST2*A0(JA2)+CNST21*HOLD
      IF (ENGPOS .EQ. 2) GO TO 144
      CNST1=1.
      CNST12=RTRANS*CNSTM
      CNST21=-RTRANS*KMAST2*KICS/(KMAST1*(KMAST2+KICS))
      CNST2=CNSTM
      GO TO 145
  144 CNST1=1./RTRANS
      CNST12=CNSTM
      CNST21=1.
      CNST2=-CNSTM/RTRANS*KMAST1*KICS/(KMAST2*(KMAST1+KICS))
  145 DO 146 I=1,80
      JA1=(I-1)*80+27
      JA2=JA1+30
      HOLD=A2(JA1)
      A2(JA1)=CNST1*HOLD+CNST12*A2(JA2)
      A2(JA2)=CNST2*A2(JA2)+CNST21*HOLD
      HOLD=A1(JA1)
      A1(JA1)=CNST1*HOLD+CNST12*A1(JA2)
      A1(JA2)=CNST2*A1(JA2)+CNST21*HOLD
      HOLD=A0(JA1)
      A0(JA1)=CNST1*HOLD+CNST12*A0(JA2)
      A0(JA2)=CNST2*A0(JA2)+CNST21*HOLD
      IF (I .GT. 3) GO TO 146
      HOLD=BG(JA1)
      BG(JA1)=CNST1*HOLD+CNST12*BG(JA2)
      BG(JA2)=CNST2*BG(JA2)+CNST21*HOLD
  146 CONTINUE
      CIENG=IENG/(FLOAT(NBLAD1)*IB1)
      CNST1=FLOAT(NBLAD1)*IB1*OMEGA1**2
      IF (ENGPOS .EQ. 2) GO TO 147
      CKMM=KMAST1*KMAST2+KICS*(KMAST1+KMAST2*RTRANS**2)
      CKMI=KMAST2*KICS/(KMAST2+KICS)/CNST1
      CKEM=KENG*CKMM/(KENG*(KMAST2+KICS)+CKMM)/CNST1
      CKEI=KENG*RTRANS**2*KMAST2*KICS/(KENG*(KMAST2+KICS)+CKMM)/CNST1
      GO TO 148
  147 CKMM=KMAST1*KMAST2+KICS*(KMAST2+KMAST1/RTRANS**2)
      CKMI=KMAST1*KICS/(KMAST1+KICS)/CNST1
      CKEM=KENG*CKMM/(KENG*(KMAST1+KICS)+CKMM)/CNST1
      CKEI=KENG/RTRANS**2*KMAST1*KICS/(KENG*(KMAST1+KICS)+CKMM)/CNST1
  148 A2(2107)=A2(2107)+CIENG
      A2(4827)=A2(4827)+CIENG
      A1(2107)=A1(2107)+EDAMP
      A1(4827)=A1(4827)+EDAMP
      B(1307)=B(1307)+QTHRTL
      A0(4537)=A0(4537)+CKMI
      A2(2141)=A2(2141)+CIENG
      A2(4861)=A2(4861)+CIENG
      A1(2141)=A1(2141)+EDAMP
      A1(4861)=A1(4861)+EDAMP
      A0(4861)=A0(4861)+CKEM
      A0(4541)=A0(4541)-CKEI
      B(1341)=B(1341)+QTHRTL
  140 A2(6238)=TAUW
      A2(6319)=TAUH
      A2(6400)=TAUV
      A1(6238)=1.
      A1(6319)=1.
      A1(6400)=1.
      A1(2238)=CWRTR1
      A1(4638)=CWRTR2
      A1(2239)=CHRTR1
      A1(4639)=CHRTR2
      A1(2240)=CVRTR1
      A1(4640)=CVRTR2
      IF (OPGRND .EQ. 0) GO TO 242
      GLMDA2=(LMDA02-MUZ2)/(1.-(CSEGE2*.25/ZAGL2)**2)
      GLMDA1=(LMDA01-MUZ1)/(1.-(CSEGE1*.25/ZAGL1)**2)
      DLDZ1=CNSTL1*GLMDA1*CSEGE1**2*.125/ZAGL1**3
      DLDZ2=CNSTL2*GLMDA2*CSEGE2**2*.125/ZAGL2**3*RADUS1/RADUS2
      SNT=SIN(THETAF)
      CST=COS(THETAF)
      SNP=SIN(PHIF)
      CSP=COS(PHIF)
      A0(4908)=A0(4908)-DLDZ1*(ZRTR1*SNP-YRTR1*CSP)*CST
      A0(4938)=A0(4938)-DLDZ2*(ZRTR2*SNP-YRTR2*CSP)*CST
      A0(4988)=A0(4988)-DLDZ1*((ZRTR1*CSP+YRTR1*SNP)*SNT+XRTR1*CST)
      A0(5018)=A0(5018)-DLDZ2*((ZRTR2*CSP+YRTR2*SNP)*SNT+XRTR2*CST)
      A0(5148)=A0(5148)-DLDZ1*SNT
      A0(5178)=A0(5178)-DLDZ2*SNT
      A0(5228)=A0(5228)+DLDZ1*CST*SNP
      A0(5258)=A0(5258)+DLDZ2*CST*SNP
      A0(5308)=A0(5308)+DLDZ1*CST*CSP
      A0(5338)=A0(5338)+DLDZ2*CST*CSP
      DO 243 I=1,NEM
      JA1=(I+66)*80+28
      JA2=JA1+30
      A0(JA1)=A0(JA1)+DLDZ1*(-ZETAR1(1,I)*SNT+ZETAR1(2,I)*CST*SNP+ZETAR1-
     1(3,I)*CST*CSP)
  243 A0(JA2)=A0(JA2)+DLDZ2*(-ZETAR2(1,I)*SNT+ZETAR2(2,I)*CST*SNP+ZETAR2-
     1(3,I)*CST*CSP)
  242 IF ((NBLAD1 .NE. 2) .AND. (NBLAD2 .NE. 2)) GO TO 159
      CSPSI=COS(PSI)
      SNPSI=SIN(PSI)
  159 IF (OPTORS(1) .EQ. 1) GO TO 153
      CNSTC=B(97)*RADUS1
      CNSTS=B(178)*RADUS1
      IF (NBLAD1 .EQ. 2) GO TO 151
      DO 152 I=1,NEM
      JA=(I+66)*80+17
      A0(JA)=A0(JA)+CNSTC*KPMC1(I)
  152 A0(JA+1)=A0(JA+1)+CNSTS*KPMS1(I)
      GO TO 153
  151 DO 154 I=1,NEM
      JA=(I+66)*80+17
  154 A0(JA)=A0(JA)+CNSTC*KPMC1(I)*CSPSI+CNSTC*KPMS1(I)*SNPSI
  153 IF (OPTORS(2) .EQ. 1) GO TO 157
      CNSTC=B(767)*RADUS1
      CNSTS=B(848)*RADUS1
      IF (NBLAD2 .EQ. 2) GO TO 155
      DO 156 I=1,NEM
      JA=(I+66)*80+47
      A0(JA)=A0(JA)+CNSTC*KPMC2(I)
  156 A0(JA+1)=A0(JA+1)+CNSTS*KPMS2(I)
      GO TO 157
  155 DO 158 I=1,NEM
      JA=(I+66)*80+47
  158 A0(JA)=A0(JA)+CNSTC*KPMC2(I)*CSPSI+CNSTC*KPMS2(I)*SNPSI
  157 IF (OPTORS(1) .NE. 1) GO TO 50
      JN=80*NBLAD1
      DO 252 J=1,JN
  252 B(J)=-A0(J+1200)
      DO 253 I=1,NBM1
      DO 253 J=1,JN
      JA=(I-1)*JN+J
      IF (JA .GT. 1200) GO TO 253
      A0(JA)=A0(JA)-KPB1(I)*A0(J+1200)
  253 CONTINUE
      IF (GIMBL1 .EQ. 0) GO TO 254
      JN=160
      IF (NBLAD1 .EQ. 2) JN=80
      DO 255 J=1,JN
  255 A0(J+1920)=A0(J+1920)-KPG1*A0(J+1280)
  254 CNST1=1.
      CNST2=0.
      IF (ENGPOS .EQ. 2) CNST1=1./RTRANS
      IF (ENGPOS .EQ. 2) CNST2=1.
      IF (NBLAD1 .EQ. 2) GO TO 257
      DO 258 J=1,80
      HOLD=TRS1*A0(J+1280)-TRC1*A0(J+1360)
      A0(J+2080)=A0(J+2080)+CNST1*HOLD
  258 A0(J+4480)=A0(J+4480)+CNST2*HOLD
      GO TO 256
  257 TCYC=-TRC1*SNPSI+TRS1*CSPSI
      DO 259 J=1,80
      A0(J+2080)=A0(J+2080)+CNST1*TCYC*A0(J+1280)
  259 A0(J+4480)=A0(J+4480)+CNST2*TCYC*A0(J+1280)
  256 IF (NBLAD1 .EQ. 2) GO TO 250
      DO 251 I=1,NEM
      DO 251 J=1,80
      JA=(I+66)*80+J
  251 A0(JA)=A0(JA)-(KPMC1(I)*A0(J+1280)+KPMS1(I)*A0(J+1360))*RADUS1
      GO TO 50
  250 DO 1252 I=1,NEM
      DO 1252 J=1,80
      JA=(I+66)*80+J
 1252 A0(JA)=A0(JA)-(KPMC1(I)*CSPSI+KPMS1(I)*SNPSI)*A0(J+1280)*RADUS1
   50 IF (OPTORS(2) .NE. 1) GO TO 51
      JN=80*NBLAD2
      DO 352 J=1,JN
  352 B(J+640)=-A0(J+3600)
      DO 353 I=1,NBM2
      DO 353 J=1,JN
      JA=(I+29)*JN+J
      IF (JA .GT. 3600) GO TO 353
      A0(JA)=A0(JA)-KPB2(I)*A0(J+3600)
  353 CONTINUE
      IF (GIMBL2 .EQ. 0) GO TO 354
      JN=160
      IF (NBLAD2 .EQ. 2) JN=80
      DO 355 J=1,JN
  355 A0(J+4320)=A0(J+4320)-KPG2*A0(J+3680)
  354 CNST1=RTRANS
      CNST2=1.
      IF (ENGPOS .EQ. 2) CNST1=1.
      IF (ENGPOS .EQ. 2) CNST2=0.
      IF (NBLAD2 .EQ. 2) GO TO 357
      DO 358 J=1,80
      HOLD=TRS2*A0(J+3680)-TRC2*A0(J+3760)
      A0(J+2080)=A0(J+2080)+CNST1*HOLD
  358 A0(J+4480)=A0(J+4480)+CNST2*HOLD
      GO TO 356
  357 TCYC=-TRC2*SNPSI+TRS2*CSPSI
      DO 359 J=1,80
      A0(J+2080)=A0(J+2080)+CNST1*TCYC*A0(J+3680)
  359 A0(J+4480)=A0(J+4480)+CNST2*TCYC*A0(J+3680)
  356 IF (NBLAD2 .EQ. 2) GO TO 350
      DO 351 I=1,NEM
      DO 351 J=1,80
      JA=(I+66)*80+J
  351 A0(JA)=A0(JA)-(KPMC2(I)*A0(J+3680)+KPMS2(I)*A0(J+3760))*RADUS1
      GO TO 51
  350 DO 1352 I=1,NEM
      DO 1352 J=1,80
      JA=(I+66)*80+J
 1352 A0(JA)=A0(JA)-(KPMC2(I)*CSPSI+KPMS2(I)*SNPSI)*A0(J+3680)*RADUS1
   51 IF (OPGOVR .EQ. 0) GO TO 52
      DO 53 I=1,80
      CNSTB=KIR1GV*B(I)+KIR2GV*B(I+640)+KIEGOV*B(I+1280)
      A0(I+2080)=A0(I+2080)-CNSTB
      A0(I+4800)=A0(I+4800)-CNSTB
      CNSTB=(KPR1GV*B(I)+KPR2GV*B(I+640)+KPEGOV*B(I+1280))*OMEGA1
      A1(I+2080)=A1(I+2080)-CNSTB
   53 A1(I+4800)=A1(I+4800)-CNSTB
   52 DO 331 I=1,5
      DO 331 K=1,80
      DO 331 J=1,11
      JB=(I+20)*80+K
      J1=(J-1)*80+K
      IF (J .GE. 4) J1=J1+400
      IF (J .GE. 7) J1=J1+400
  331 B(JB)=B(JB)+B(J1)*TCFE(J,I)
      MX=0
      MX1=0
      MX0=0
      MV=0
      MVG=0
      DO 60 I=1,80
      MX=MX+DOF(I)
      DOF1(I)=1
   60 DOF0(I)=1
      IF  (OPFLOW .NE. 0) GO TO 69
      IF ((OPGOVR.NE.0) .AND. ((KIR1GV.NE.0.).OR.(KIR2GV.NE.0.).OR.(KIEG-
     1OV.NE.0.))) GO TO 69
      DOF1(27)=0
      IF (DOF(27) .NE. 0)  MX1=MX1+1
   69 DO 63 I=28,30
      DOF1(I)=0
      IF (DOF(I) .EQ. 0) GO TO 163
      MX1=MX1+1
      IF (OPLMDA(1) .NE. 0) GO TO 163
      DOF0(I)=0
      MX0=MX0+1
  163 DOF1(I+30)=0
      IF (DOF(I+30) .EQ. 0) GO TO 63
      MX1=MX1+1
      IF (OPLMDA(2) .NE. 0) GO TO 63
      DOF0(I+30)=0
      MX0=MX0+1
   63 CONTINUE
      DO 64 I=78,80
      DOF1(I)=0
      IF (DOF(I) .EQ. 0) GO TO 64
      MX1=MX1+1
      IF (OPINTR .NE. 0) GO TO 64
      DOF0(I)=0
      MX0=MX0+1
   64 CONTINUE
      IF (OPTORS(1) .NE. 2) GO TO 65
      DO 66 I=16,24
      IF (DOF(I) .EQ. 0) GO TO 66
      DOF0(I)=0
      MX0=MX0+1
   66 CONTINUE
   65 IF (OPTORS(2) .NE. 2) GO TO 67
      DO 68 I=46,54
      IF (DOF(I) .EQ. 0) GO TO 68
      DOF0(I)=0
      MX0=MX0+1
   68 CONTINUE
   67 IF ((A0(5148).EQ.0.).AND.(A0(5178).EQ.0.)) DOF1(65)=0
      IF ((A0(5228).EQ.0.).AND.(A0(5258).EQ.0.)) DOF1(66)=0
      IF ((A0(5308).EQ.0.).AND.(A0(5338).EQ.0.)) DOF1(67)=0
      DOF1(64)=0
      DO 167 I=64,67
      IF ((DOF1(I) .EQ. 0) .AND. (DOF(I) .EQ. 1)) MX1=MX1+1
  167 CONTINUE
      IF (OPQRTR .EQ. 0) GO TO 261
      IF (OPQRTR .EQ. 2) GO TO 262
      DO 263 I=1,30
      IF (DOF(I) .EQ. 0) GO TO 263
      IF (DOF0(I) .EQ. 0) GO TO 263
      DOF0(I)=0
      MX0=MX0+1
  263 CONTINUE
  262 IF (OPQRTR .EQ. 1) GO TO 264
      DO 265 I=31,61
      IF (DOF(I) .EQ. 0) GO TO 265
      IF (DOF0(I) .EQ. 0) GO TO 265
      DOF0(I)=0
      MX0=MX0+1
  265 CONTINUE
  264 IF (OPQRTR .NE. 4) GO TO 261
      DO 266 I=68,80
      IF (DOF(I) .EQ. 0) GO TO 266
      IF (DOF0(I) .EQ. 0) GO TO 266
      DOF0(I)=0
      MX0=MX0+1
  266 CONTINUE
  261 DO 61 I=1,26
   61 MV=MV+CON(I)
      DO 62 I=1,3
   62 MVG=MVG+GUST(I)
      CALL DERED(80,26,3,DOF,CON,GUST,A2,A1,A0,B,BG,DOF1,DOF0)
      MVX=MX*MV
      MVGX=MX*MVG
      DO 160 I=1,MVGX
      I1=I+MVX
  160 B0(I1)=BG(I)
      MV=MV+MVG
      IF (MX0 .NE. 0) CALL QSTRAN(MX,MX0,MX1,MV,A2,A1,A0,B0,DOF1,DOF0)
      IF (DEBUG .EQ. 0) GO TO 81
      MXSQ1=MX*MX+1
      IF (MXSQ1 .GT. 6400) GO TO 82
      DO 83 I=MXSQ1,6400
      A2(I)=0.
      A1(I)=0.
   83 A0(I)=0.
   82 MVX1=MX*MV+1
      IF (MVX1 .GT. 2320) GO TO 81
      DO 85 I=MVX1,2320
   85 B0(I)=0.
   81 IF (DEBUG .GE. 2) WRITE(6,NLHL)
      IF (DEBUG .EQ. 3) WRITE(6,NLR)
      IF (DEBUG .EQ. 3) WRITE(6,NLS)
      IF ((DEBUG.EQ.1).OR.(DEBUG.EQ.3)) WRITE(6,NLEQ)
    1 CONTINUE
      RETURN
      END
      SUBROUTINE AIR(ALT,TEMP,DENSE,CSOUND,GRAV,ALTD,OPUNIT)
      INTEGER OPUNIT
      DIMENSION H1(2),T0(2),T1(2),CS(2),G(2)
      DATA H1/145442.,44330.8/
      DATA T1/459.67,273.15/
      DATA T0/518.67,288.15/
      DATA CS/1116.45,340.294/
      DATA G/32.17405,9.80665/
      TS=1.-ALT/H1(OPUNIT)
      T=TS
      IF (TEMP .LT. 999.) T=(T1(OPUNIT)+TEMP)/T0(OPUNIT)
      DENSE=TS**5.256115/T
      CSOUND=CS(OPUNIT)*SQRT(T)
      ALTD=H1(OPUNIT)*(1.-DENSE**.234956)
      GRAV=G(OPUNIT)
      RETURN
      END
      SUBROUTINE HLAERO(VEL,VELX,VELY,VELZ,THETAF,PHIF,DEBUG)
      INTEGER DEBUG
      COMMON /FAERO/CZDZ,CZDX,CZDT,CZDDZ,CXDZ,CXDX,CXDT,CTDZ,CTDX,CTDT,C-
     1TDDZ,CZDQ(8),CZQ(8),CXDQ(8),CXQ(8),CTDQ(8),CTQ(8),CQDZ(8),CQDX(8),-
     2CQDT(8),CQDQ(8,8),CQQ(8,8),CZF,CZE,CZLW,CZLH,CXF,CXE,CXLW,CXLH,CTF-
     3,CTE,CTLW,CTLH,CQF(8),CQE(8),CQLW(8),CQLH(8),CFDF,CFDP,CFDY,CPDF,C-
     4PDP,CPDY,CYDF,CYDP,CYDY,CFDQ(8),CFQ(8),CPDQ(8),CPQ(8),CYDQ(8),CYQ(-
     58),CQDF(8),CQDP(8),CQDY(8),CQDQA(8,8),CQQA(8,8),CFA,CFR,CFLV,CPA,C-
     6PR,CPLV,CYA,CYR,CYLV,CQA(8),CQR(8),CQLV(8),CFDZ,CFDX,CFLW,CPDZ,CPD-
     7X,CPLW,CYDZ,CYDX,CYLW,CQDZA(8),CQDXA(8),CQLWA(8)
      COMMON /XTRIM/LW,DW,MYW,YW,MXW,MZW,LH,DH,LV,DV,LAW,LFW,LEW,DAW,DFW-
     1,DEW,MAW,MFW,NXBW,NZBW,YBW,LAH,LEH,DAH,DEH,LAV,LEV,DAV,DEV
      REAL LW,MYW,MXW,MZW,LH,LV,LAW,LFW,LEW,MAW,MFW,NXBW,NZBW,LAH,LEH,LA-
     1V,LEV
      COMMON /FADATA/LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,DRG-
     10W,DRGDW,DRGFW,DRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB,S-
     2PANW,AREAW,CHORDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,LF-
     3TEH,AMAXH,IHT,SPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,XWB,ZWB,XHT,ZHT,XV-
     4T,ZVT,RADIUS,GAMSA,AFLAP
      REAL LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,KCLB,IWB,LFLA-
     1PO,LFLAPI,LAILO,LAILI,LFTAH,LFTEH,IHT,LFTAV,LFTEV,IVT
      COMMON /FEDATA/EZZ(10,10),EXX(10,10),EZX(10,10),EXZ(10,10),EZ(10),-
     1EX(10),ET(10),EZT(10,10),EXT(10,10),ETT(10,10),EZD(10),EXD(10),EZL-
     2(10),EXL(10),ETL(10),FZH(10),FXH(10),FTH(10),FYW(10),FFH(10),FYV(1-
     30),FFV(10),FPV(10),IDENT(10)
      REAL KLAW,KDAW,KLUW,KDUW,KLTW,KDTW,KLEW,KDEW,KLWW,KDWW,KLAH,KDAH,K-
     1LUH,KDUH,KLTH,KDTH,KLEH,KDEH,KLWH,KDWH,KLAV,KDAV,KLUV,KDUV,KLTV,KD-
     2TV,KLEV,KDEV,KLWV,KDWV,KMAW,KMUW,KLFW,KDFW
      REAL ZERO(530),LVT
      EQUIVALENCE (ZERO(1),CZDZ)
      NAMELIST /NLDB/LW,DW,MYW,YW,MXW,MZW                               -
     1,LH,DH,LV,DV,LAW,LFW,LEW,DAW,DFW,DEW,MAW,MFW,NXBW,NZBW,YBW,LAH,LEH-
     2,DAH,DEH,LAV,LEV,DAV,DEV,                                         -
     3CZDZ,CZDX,CZDT,CZDDZ,CXDZ,CXDX,CXDT,CTDZ,CTDX,CTDT,CTDDZ,CZDQ,CZQ,-
     4CXDQ,CXQ,CTDQ,CTQ,CQDZ,CQDX,CQDT,CQDQ,CQQ,CZF,CZE,CZLW,CZLH,CXF,CX-
     5E,CXLW,CXLH,CTF,CTE,CTLW,CTLH,CQF,CQE,CQLW,CQLH,CFDF,CFDP,CFDY,CPD-
     6F,CPDP,CPDY,CYDF,CYDP,CYDY,CFDQ,CFQ,CPDQ,CPQ,CYDQ,CYQ,CQDF,CQDP,CQ-
     7DY,CQDQA,CQQA,CFA,CFR,CFLV,CPA,CPR,CPLV,CYA,CYR,CYLV,CQA,CQR,CQLV,-
     8CFDZ,CFDX,CFLW,CPDZ,CPDX,CPLW,CYDZ,CYDX,CYLW,CQDZA,CQDXA,CQLWA,   -
     F     KLAW,KDAW,KLUW,KDUW,KLTW,KDTW,KLEW,KDEW,KLWW,KDWW,KLAH,KDAH,K-
     GLUH,KDUH,KLTH,KDTH,KLEH,KDEH,KLWH,KDWH,KLAV,KDAV,KLUV,KDUV,KLTV,KD-
     HTV,KLEV,KDEV,KLWV,KDWV,KMAW,KMUW,KLFW,KDFW,                       -
     ALFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,DRG0W,DRGDW,DRGFW,-
     BDRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB,SPANW,AREAW,CHOR-
     CDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,LFTEH,AMAXH,IHT,S-
     DPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,EZZ,EXX,EZX,EXZ,EZ,EX,ET,EZT,EXT,-
     EETT,EZD,EXD,EZL,EXL,ETL,FZH,FXH,FTH,FYW,FFH,FYV,FFV,FPV,IDENT
      FLA(X1,X2,X3,X4)=((X2+X3)*CS*CS+2.*X3*SN*SN+(X4+X1)*SN*CS)/RAREA
      FDA(X1,X2,X3,X4)=((X4-X1)*CS*CS-2.*X1*SN*SN-(X2-X3)*SN*CS)/RAREA
      FLU(X1,X2,X3,X4)=(2.*X1*CS*CS-(X4-X1)*SN*SN-(X2-X3)*SN*CS)/RAREA
      FDU(X1,X2,X3,X4)=(2.*X3*CS*CS+(X2+X3)*SN*SN-(X4+X1)*SN*CS)/RAREA
      FLD(X1,X2)=(X1*CS+X2*SN)/RAREA
      FDL(X1,X2)=(X2*CS-X1*SN)/RAREA
      DO 1 I=1,530
    1 ZERO(I)=0.
      IF (VEL .EQ. 0.) RETURN
      QY=COS(PHIF)
      RX=-SIN(THETAF)
      RY=SIN(PHIF)*COS(THETAF)
      RZ=COS(PHIF)*COS(THETAF)
      V1=GAMSA*VEL
      V2=V1*VEL
      RAREA=3.141593*RADIUS**2
      RAREAR=RAREA*RADIUS
      PHIW=DIHEDW/57.29578
      PSIW=SWEEPW/57.29578
      CS=0.
      SN=0.
      IF ((VELX .EQ. 0.) .AND. (VELZ .EQ. 0.)) GO TO 2
      CS=VELX/SQRT(VELX**2+VELZ**2)
      SN=VELZ/SQRT(VELX**2+VELZ**2)
    2 KLAW=FLA(LW,LAW,DW,DAW)
      KDAW=FDA(LW,LAW,DW,DAW)
      KLUW=FLU(LW,LAW,DW,DAW)
      KDUW=FDU(LW,LAW,DW,DAW)
      KMAW=(MAW*CS+2.*MYW*SN)/RAREAR
      KMUW=(2.*MYW*CS-MAW*SN)/RAREAR
      KLTW=FLD(LAW,DAW)
      KDTW=FDL(LAW,DAW)
      KLEW=FLD(LEW,DEW)
      KDEW=FDL(LEW,DEW)
      KLFW=FLD(LFW,DFW)
      KDFW=FDL(LFW,DFW)
      KLWW=FLD(LAW+DW,DAW-LW)
      KDWW=FDL(LAW+DW,DAW-LW)
      KLAH=FLA(LH,LAH,DH,DAH)
      KDAH=FDA(LH,LAH,DH,DAH)
      KLUH=FLU(LH,LAH,DH,DAH)
      KDUH=FDU(LH,LAH,DH,DAH)
      KLTH=FLD(LAH,DAH)
      KDTH=FDL(LAH,DAH)
      KLEH=FLD(LEH,DEH)
      KDEH=FDL(LEH,DEH)
      KLWH=FLD(LAH+DH,DAH-LH)
      KDWH=FDL(LAH+DH,DAH-LH)
      CS=0.
      SN=0.
      IF ((VELX .EQ. 0.) .AND. (VELY .EQ. 0.)) GO TO 3
      CS=VELX/SQRT(VELX**2+VELY**2)
      SN=VELY/SQRT(VELX**2+VELY**2)
    3 KLAV=FLA(LV,LAV,DV,DAV)
      KDAV=FDA(LV,LAV,DV,DAV)
      KLUV=FLU(LV,LAV,DV,DAV)
      KDUV=FDU(LV,LAV,DV,DAV)
      KLTV=FLD(LAV,DAV)
      KDTV=FDL(LAV,DAV)
      KLEV=FLD(LEV,DEV)
      KDEV=FDL(LEV,DEV)
      KLWV=FLD(LAV+DV,DAV-LV)
      KDWV=FDL(LAV+DV,DAV-LV)
      DEDA=0.
      IF (AREAW .NE. 0.) DEDA=.45*LAW/AREAW/((SPANW**2/AREAW)**.735*(ABS-
     1(XHT*RADIUS/CHORDW))**.25)
      DSDB=1.
      DSDP=0.
      DSDR=1.
      DEDA1=1.-DEDA
      DLF=LFLAPO-LFLAPI
      DLA=LAILO**2-LAILI**2
      CZDZ=-V1*(KLAW+DEDA1*KLAH)
      CZDX=-V1*(KLUW+KLUH)
      CZDT=-V1*QY*(ZWB*KLUW-XWB*KLAW+ZHT*KLUH-XHT*KLAH)
      CZDDZ=-V1*DEDA*(ZHT*KLUH-XHT*KLAH)
      CXDZ=-V1*(KDAW+DEDA1*KDAH)
      CXDX=-V1*(KDUW+KDUH)
      CXDT=-V1*QY*(ZWB*KDUW-XWB*KDAW+ZHT*KDUH-XHT*KDAH)
      CTDZ=-V1*QY*(ZWB*KDAW-XWB*KLAW+DEDA1*(ZHT*KDAH-XHT*KLAH)-KMAW)
      CTDX=-V1*QY*(ZWB*KDUW-XWB*KLUW+DEDA1*(ZHT*KDUH-XHT*KLUH)-KMUW)
      CTDT=-V1*QY*QY*(XWB*XWB*KLAW+ZWB*ZWB*KDUW-XWB*ZWB*(KDAW+KLUW)+XHT*-
     1XHT*KLAH+ZTH*ZHT*KDUH-XHT*ZHT*(KDAH+KLUH))
      CTDDZ=-V1*QY*DEDA*(XHT*XHT*KLAH+ZHT*ZHT*KDUH-XHT*ZHT*(KDAH+KLUH))
      CZF=-V2*DLF*KLFW
      CZE=-V2*KLEH
      CZLW=V1*KLWW
      CZLH=V1*KLWH
      CXF=-V2*DLF*KDFW
      CXE=-V2*KDEH
      CXLW=V1*KDWW
      CXLH=V1*KDWH
      CTF=-V2*QY*DLF*(ZWB*KDFW-XWB*KLFW-MFW/RAREAR)
      CTE=-V2*QY*(ZHT*KDEH-XHT*KLEH)
      CTLW=V1*QY*(ZWB*KDWW-XWB*KLWW-MAW/RAREAR)
      CTLH=V1*QY*(ZHT*KDWH-XHT*KLWH)
      LVT=XVT*RZ-ZVT*RX
      S1=.25*SPANW/RADIUS
      S2=(SPANW/RADIUS)**2/12.
      CFDF=-V1*(S2*KLAW+DSDP*ZVT*ZVT*KLAV)
      CFDP=-V1*(S2*(-RZ*KLUW+RX*KLAW)-DSDR*(ZVT*LVT*KLAV+ZVT*ZVT*RY*KLUV-
     1))
      CFDY=-V1*(S1*(PSIW*KLUW+PHIW*KLAW)*KCLB-DSDB*ZVT*KLAV-NXBW/RAREAR)
      CPDF=-V1*(S2*(-RZ*KDAW+RX*KLAW)-DSDP*(ZVT*LVT*KLAV+ZVT*ZVT*RY*KDAV-
     1))
      CPDP=-V1*(S2*(RZ*RZ*KDUW+RX*RX*KLAW-RZ*RX*(KDAW+KLUW))+DSDR*(LVT*L-
     1VT*KLAV+(ZVT*RY)**2*KDUV+LVT*ZVT*RY*(KDAV+KLUV)))
      CPDY=-V1*(-S1*RZ*(PSIW*KDUW+PHIW*KDAW)+S1*RX*(PSIW*KLUW+PHIW*KLAW)-
     1+DSDB*(LVT*KLAV+ZVT*RY*KDAV)-RZ*NZBW/RAREAR)
      CYDF=-V1*(S1*(PSIW*KDAW+PHIW*KLAW)-DSDP*ZVT*KLAV)
      CYDP=-V1*(-S1*RZ*(PSIW*KDUW+PHIW*KLUW)+S1*RX*(PSIW*KDAW+PHIW*KLAW)-
     1+DSDR*(LVT*KLAV+ZVT*RY*KLUV))
      CYDY=-V1*(DSDB*KLAV-YBW/RAREA)
      CFA=-V2*S1*DLA*KLEW
      CFR=V2*ZVT*KLEV
      CFLV=-V1*ZVT*KLWV
      CPA=-V2*S1*DLA*(RX*KLEW-RZ*KDEW)
      CPR=-V2*(LVT*KLEV+ZVT*RY*KDEV)
      CPLV=V1*(LVT*KLWV+ZVT*RY*KDWV)
      CYA=-V2*S1*DLA*(PSIW*KDEW+PHIW*KLEW)
      CYR=-V2*KLEV
      CYLV=V1*KLWV
      CFDZ=-V1*S1*KLAW
      CFDX=-V1*S1*KLUW
      CFLW=V1*S1*KLWW
      CPDZ=-V1*S1*(-RZ*KDAW+RX*KLAW)
      CPDX=-V1*S1*(-RZ*KDUW+RX*KLUW)
      CPLW=V1*S1*(-RZ*KDWW+RX*KLWW)
      CYDZ=-V1*(PSIW*KDAW+PHIW*KLAW)
      CYDX=-V1*(PSIW*KDUW+PHIW*KLUW)
      CYLW=V1*(PSIW*KDWW+PHIW*KLWW)
      IA=0
      IS=0
      DO 40 I=1,10
      IF (IDENT(I)) 41,40,42
   42 IS=IS+1
      CEX=EX(I)
      CEZ=EZ(I)
      CFX=FXH(I)
      CFZ=FZH(I)
      CZDQ(IS)=-V1*(-CEX*KLUW-CEZ*KLAW+CFX*KLUH+CFZ*KLAH)
      CZQ(IS)=-V2*(ET(I)*KLTW+FTH(I)*KLTH)
      CXDQ(IS)=-V1*(-CEX*KDUW-CEZ*KDAW+CFX*KDUH+CFZ*KDAH)
      CXQ(IS)=-V2*(ET(I)*KDTW+FTH(I)*KDTH)
      CTDQ(IS)=-V1*QY*(-CEX*(ZWB*KDUW-XWB*KLUW)-CEZ*(ZWB*KDAW-ZWB*KLAW)+-
     1CFX*(ZHT*KDUH-XHT*KLUH)+CFZ*(ZHT*KDAH-XHT*KLAH))
      CTQ(IS)=-V2*(ET(I)*(ZWB*KDTW-XWB*KLTW)+FTH(I)*(ZHT*KDTH-XHT*KLTH))
      CQDZ(IS)=-V1*(-CEX*KDAW-CEZ*KLAW+CFX*KDAH+CFZ*KLAH)
      CQDX(IS)=-V1*(-CEX*KDUW-CEZ*KLUW+CFX*KDUH+CFZ*KLUH)
      CQDT(IS)=-V1*QY*(-CEX*(ZWB*KDUW-XWB*KDAW)-CEZ*(ZWB*KLUW-XWB*KLAW)+-
     1CFX*(ZHT*KDUH-XHT*KDAH)+CFZ*(ZHT*KLUH-XHT*KLAH))
      CQF(IS)= V2*(EXD(I)*KDFW+EZD(I)*KLFW)
      CQE(IS)=-V2*(CFX*KDEH+CFZ*KLEH)
      CQLW(IS)=V1*(-CEX*KDWW-CEZ*KLWW)
      CQLH(IS)=V1*(CFX*KDWH+CFZ*KLWH)
      JS=0
      DO 43 J=1,10
      IF (IDENT(J) .NE. 1) GO TO 43
      JS=JS+1
      CQDQ(IS,JS)=-V1*(EZZ(I,J)*KLAW+EZX(I,J)*KLUW+EXZ(I,J)*KDAW+EXX(I,J-
     1)*KDUW+.125*AREAW*CHORDW/RAREAR*ETT(I,J)+CFZ*(FZH(J)*KLAH+FXH(J)*K-
     2LUH)+CFX*(FZH(J)*KDAH+FXH(J)*KDUH))
      CQQ(IS,JS)=-V2*(-EXT(I,J)*KDTW-EZT(I,J)*KLTW+FTH(I)*(FZH(J)*KLTH+F-
     1XH(J)*KDTH))
   43 CONTINUE
      GO TO 40
   41 IA=IA+1
      CEX=EXL(I)
      CEZ=EZL(I)
      S3=(SPANH/RADIUS)**2/12.
      S4=(SPANV/RADIUS)**2/12.
      CFDQ(IA)=-V1*(-CEX*KLUW-CEZ*KLAW+S3*FFH(I)*KLAH-FYV(I)*ZVT*KLAV)
      CFQ(IA)=-V2*(ETL(I)*KLTW+FPV(I)*ZVT*KLTV)
      CPDQ(IA)=-V1*(-CEX*(-RZ*KDUW+RX*KLUW)-CEZ*(-RZ*KDAW+RX*KLAW)+FFH(I-
     1)*S3*(-RZ*KDAH+RX*KLAH)+FYV(I)*(LVT*KLAV+ZVT*RY*KDAV))
      CPQ(IA)=-V2*(ETL(I)*(RX*KLTW-RZ*KDTW)-FPV(I)*(LVT*KLTV+ZVT*RY*KDTV-
     1))
      CYDQ(IA)=-V1*(-EX(I)*(PSIW*KDUW+PHIW*KLUW)-EZ(I)*(PSIW*KDAW+PHIW*K-
     1LAW)+FYV(I)*KLAV)
      CYQ(IA)=-V2*(ET(I)*(PHIW*KLTW+PSIW*KDTW)-FPV(I)*KLTV)
      CQDF(IA)=-V1*(-CEX*KDAW-CEZ*KLAW+FFH(I)*S3*KLAH-FYV(I)*ZVT*KLAV)
      CQDP(IA)=-V1*(-CEX*(-RZ*KDUW+RX*KDAW)-CEZ*(-RZ*KLUW+RX*KLAW)+FFH(I-
     1)*S3*(-RZ*KLUH+RX*KLAH)+FYV(I)*(LVT*KLAV+ZVT*RY*KLUV))
      CQDY(IA)=-V1*(-EX(I)*(PSIW*KDUW+PHIW*KDAW)-EZ(I)*(PSIW*KLUW+PHIW*K-
     1LAW)+FYV(I)*KLAV)
      CQA(IA)=V2*(EXD(I)*KDEW+EZD(I)*KLEW)
      CQR(IA)=-V2*FYV(I)*KLEV
      CQLV(IA)=V1*FYV(I)*KLWV
      CEX=EX(I)-FYW(I)*PSIW
      CEZ=EZ(I)-FYW(I)*PHIW
      CQDZA(IA)=V1*(CEX*KDAW+CEZ*KLAW)
      CQDXA(IA)=V1*(CEX*KDUW+CEZ*KLUW)
      CQLWA(IA)=-V1*(CEX*KDWW+CEZ*KLWW)
      JA=0
      DO 44 J=1,10
      IF (IDENT(J) .NE. -1) GO TO 44
      JA=JA+1
      CQDQA(IA,JA)=-V1*(EZZ(I,J)*KLAW+EZX(I,J)*KLUW+EXZ(I,J)*KDAW+EXX(I,-
     1J)*KDUW+.125*AREAW*CHORDW/RAREAR*ETT(I,J)+FFH(I)*FFH(J)*S3*KLAH+(F-
     2YV(I)*FYV(J)+S4*FFV(I)*FFV(J))*KLAV)
      CQQA(IA,JA)=V2*(EXT(I,J)*KDTW+EZT(I,J)*KLTW+FYV(I)*FPV(J)*KLTV)
   44 CONTINUE
   40 CONTINUE
      IF (DEBUG .EQ. 3) WRITE (6,NLDB)
      RETURN
      END
      SUBROUTINE ACHAR(ALPHA,BETA,DELF,DELA,ALFHT,DELE,ALFVT,DELR)
      COMMON /XTRIM/LW,DW,MYW,YW,MXW,MZW,LH,DH,LV,DV,LAW,LFW,LEW,DAW,DFW-
     1,DEW,MAW,MFW,NXBW,NZBW,YBW,LAH,LEH,DAH,DEH,LAV,LEV,DAV,DEV
      REAL LW,MYW,MXW,MZW,LH,LV,LAW,LFW,LEW,MAW,MFW,NXBW,NZBW,LAH,LEH,LA-
     1V,LEV
      COMMON /FADATA/LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,DRG-
     10W,DRGDW,DRGFW,DRGEW,PIEL2,AMAXW,DRGSW,SIDEB,ROLLB,YAWB,KCLB,IWB,S-
     2PANW,AREAW,CHORDW,SWEEPW,DIHEDW,LFLAPO,LFLAPI,LAILO,LAILI,LFTAH,LF-
     3TEH,AMAXH,IHT,SPANH,LFTAV,LFTEV,AMAXV,IVT,SPANV,XWB,ZWB,XHT,ZHT,XV-
     4T,ZVT,RADIUS,GAMSA,AFLAP
      REAL LFTAW,LFTDW,LFTFW,LFTEW,MOM0W,MOMAW,MOMDW,MOMFW,KCLB,IWB,LFLA-
     1PO,LFLAPI,LAILO,LAILI,LFTAH,LFTEH,IHT,LFTAV,LFTEV,IVT
      DATA CVERT/57.29578/
      ALF=ALPHA+IWB/CVERT
      IF (ABS(ALF) .GT. AMAXW/CVERT) GO TO 1
      DF=AFLAP/CVERT
      LW=LFTAW*ALF+LFTDW*DF+LFTFW*(LFLAPO-LFLAPI)*DELF
      LAW=LFTAW
      LFW=LFTFW
      LEW=LFTEW
      DW=DRG0W+LW*LW/PIEL2+DRGDW*DF+DRGFW*(LFLAPO-LFLAPI)*DELF
      DAW=2.*LW*LAW/PIEL2
      DFW=DRGFW
      IF (LAW .NE. 0.) DFW=DAW*LFW/LAW+DRGFW
      DEW=DRGEW
      IF (LAW .NE. 0.) DEW=DAW*LEW/LAW+DRGEW
      MYW=MOM0W+MOMAW*ALF+MOMDW*DF+MOMFW*(LFLAPO-LFLAPI)*DELF
      MAW=MOMAW
      MFW=MOMFW
      YW=SIDEB*BETA
      YBW=SIDEB
      MXW=(-KCLB*.25*SPANW*(SWEEPW*2.*LW+DIHEDW*(LFTAW+DW))/CVERT+ROLLB)-
     1*BETA-.25*SPANW*(LAILO**2-LAILI**2)*LFTEW*DELA
      MZW=(.25*SPANW*(SWEEPW*2.*DW+DIHEDW*(DAW-LW))/CVERT+YAWB)*BETA+.25-
     1*SPANW*(LAILO**2-LAILI**2)*DEW*DELA
      NXBW=ROLLB
      NZBW=YAWB
      GO TO 2
    1 ALFS=SIGN(AMAXW/CVERT,ALF)
      LW=LFTAW*ALFS+LFTDW*DF+LFTFW*(LFLAPO-LFLAPI)*DELF
      LAW=0.
      LFW=0.
      LEW=0.
      DW=(DRGSW-DRG0W)*(SIN(ALF))**2+DRG0W
      DAW=(DRGSW-DRG0W)*SIN(2.*ALF)
      DFW=0.
      DEW=0.
      MYW=0.
      MAW=0.
      MFW=0.
      YW=0.
      YBW=0.
      MXW=0.
      MZW=0.
      NXBW=0.
      NZBW=0.
    2 ALF=ALFHT+IHT/CVERT
      IF (ABS(ALF) .GT. AMAXH/CVERT) GO TO 3
      LH=LFTAH*ALF+LFTEH*DELE
      LAH=LFTAH
      LEH=LFTEH
      GO TO 4
    3 ALFS=SIGN(AMAXH/CVERT,ALF)
      LH=LFTAH*ALFS+LFTEH*DELE
      LAH=0.
      LEH=0.
    4 DH=0.
      DAH=0.
      DEH=0.
      ALF=ALFVT+IVT/CVERT
      IF (ABS(ALF) .GT. AMAXV/CVERT) GO TO 5
      LV=LFTAV*ALF+LFTEV*DELR
      LAV=LFTAV
      LEV=LFTEV
      GO TO 6
    5 ALFS=SIGN(AMAXV/CVERT,ALF)
      LV=LFTAV*ALFS+LFTEV*DELR
      LAV=0.
      LEV=0.
    6 DV=0.
      DAV=0.
      DEV=0.
      RETURN
      END
      SUBROUTINE JUGGLE(N)
      COMMON /HLCOEF/XM1(1874),XZ1(2375),XX(17355)
      COMMON /R1DATA/XR1(667)
      COMMON /R2DATA/XR2(667)
      COMMON /RINPUT/XR(667)
      COMMON /RCOEF/XC(4236)
      COMMON /R2COEF/XC2(4236)
      COMMON /MODES/XM(1874)
      COMMON /MODES2/XM2(1874)
      COMMON /ZTRIM/XZ(2375)
      COMMON /ZTRIM2/XZ2(2375)
      GO TO (10,11,12,11,12),N
      GO TO 10
   11 DO 111 I=1,667
  111 XR1(I)=XR(I)
      GO TO 10
   12 DO 112 I=1,667
  112 XR2(I)=XR(I)
   10 GO TO (21,22,20,22,20,21,22,20,22,21,22),N
   21 DO 121 I=1,667
  121 XR(I)=XR1(I)
      GO TO 20
   22 DO 122 I=1,667
  122 XR(I)=XR2(I)
   20 GO TO (30,31,32,33,34,35,36,30,30,35,36),N
   31 DO 131 I=1531,1535
  131 XM1(I)=XM(I)
      DO 231 I=1842,1844
  231 XM1(I)=XM(I)
      GO TO 30
   32 DO 132 I=1531,1535
      XM2(I)=XM(I)
  132 XM(I)=XM1(I)
      DO 232 I=1842,1844
      XM2(I)=XM(I)
  232 XM(I)=XM1(I)
      GO TO 30
   33 DO 133 I=1,1874
  133 XM1(I)=XM(I)
      DO 233 I=1531,1535
  233 XM(I)=XM2(I)
      DO 333 I=1842,1844
  333 XM(I)=XM2(I)
      GO TO 30
   34 DO 134 I=1,1874
      XM2(I)=XM(I)
  134 XM(I)=XM1(I)
      GO TO 30
   35 DO 135 I=1,1874
  135 XM(I)=XM1(I)
      GO TO 30
   36 DO 136 I=1,1874
      XM1(I)=XM(I)
  136 XM(I)=XM2(I)
   30 GO TO (40,40,40,40,40,42,43,44,45,46,47),N
   42 DO 142 I=1,2375
      XZ2(I)=XZ(I)
  142 XZ(I)=XZ1(I)
      GO TO 40
   43 DO 143 I=1,2375
      XZ1(I)=XZ(I)
  143 XZ(I)=XZ2(I)
      GO TO 40
   44 DO 144 I=1,33
  144 XZ(I)=XZ1(I)
      GO TO 40
   45 DO 145 I=1,33
  145 XZ1(I)=XZ(I)
      DO 245 I=1,1870
  245 XZ(I)=XZ2(I)
      GO TO 40
   46 DO 146 I=1,33
  146 XZ(I)=XZ1(I)
      GO TO 40
   47 DO 147 I=1,33
      XZ1(I)=XZ(I)
  147 XZ(I)=XZ2(I)
   40 IF (N .NE. 10) GO TO 50
      DO 151 I=1,4236
  151 XC2(I)=XC(I)
   50 RETURN
      END
